登录逻辑+注册有礼
This commit is contained in:
@@ -1,15 +1,30 @@
|
||||
const TokenKey = 'admin-token';
|
||||
const TokenKey = 'access-token';
|
||||
const CompanyIdKey = 'companyId';
|
||||
const TokenPrefix = 'Bearer ';
|
||||
|
||||
function isLogin() {
|
||||
return !!uni.getStorageSync(TokenKey);
|
||||
}
|
||||
|
||||
function getToken() {
|
||||
return uni.getStorageSync(TokenKey);
|
||||
}
|
||||
|
||||
function setToken(token: string) {
|
||||
uni.setStorageSync(TokenKey, token);
|
||||
}
|
||||
|
||||
function getCompanyId() {
|
||||
return uni.getStorageSync(CompanyIdKey);
|
||||
}
|
||||
|
||||
function setCompanyId(companyId: string) {
|
||||
uni.setStorageSync(CompanyIdKey, companyId);
|
||||
}
|
||||
|
||||
function clearToken() {
|
||||
uni.removeStorageSync(TokenKey);
|
||||
uni.removeStorageSync(CompanyIdKey);
|
||||
}
|
||||
export { TokenPrefix, isLogin, getToken, setToken, clearToken };
|
||||
|
||||
export { TokenPrefix, isLogin, getToken, setToken, getCompanyId, setCompanyId, clearToken };
|
||||
|
Reference in New Issue
Block a user