import uni from './uniHooks'
export default {
	cleanKipCache () {
		uni.removeStorageSync('kipAccessToken');
		uni.removeStorageSync('isNewUser');
		uni.removeStorageSync('kipRefreshToken')
	},
	setKipCache (authInfo) {
		if (!authInfo) {
			console.error('authInfo不存在')
			return false;
		}
		const { access_token, isNewUser, refresh_token } = authInfo;
		
		uni.setStorageSync('kipAccessToken', access_token);
		uni.setStorageSync('isNewUser', isNewUser)
		uni.setStorageSync('kipRefreshToken', refresh_token)
	},
	getKipToken () {
		return uni.getStorageSync('kipAccessToken');
	},
	setKipToken (kipAccessToken) {
		uni.setStorageSync('kipAccessToken', kipAccessToken);
	},
	getKipIsNewUser () {
		return uni.getStorageSync('isNewUser');
	},
	getKipRefreshToken () {
		return uni.getStorageSync('kipRefreshToken');
	}
}
