init
This commit is contained in:
15
src/utils/auth/index.ts
Normal file
15
src/utils/auth/index.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
const TokenKey = 'admin-token';
|
||||
const TokenPrefix = 'Bearer ';
|
||||
function isLogin() {
|
||||
return !!uni.getStorageSync(TokenKey);
|
||||
}
|
||||
function getToken() {
|
||||
return uni.getStorageSync(TokenKey);
|
||||
}
|
||||
function setToken(token: string) {
|
||||
uni.setStorageSync(TokenKey, token);
|
||||
}
|
||||
function clearToken() {
|
||||
uni.removeStorageSync(TokenKey);
|
||||
}
|
||||
export { TokenPrefix, isLogin, getToken, setToken, clearToken };
|
Reference in New Issue
Block a user