26 lines
444 B
Plaintext
26 lines
444 B
Plaintext
export class Auth {
|
|
|
|
static readonly TokenKey : string = "Admin-Token"
|
|
|
|
/**
|
|
* 获取Token
|
|
*/
|
|
static getToken() : string {
|
|
const token = uni.getStorageSync(Auth.TokenKey)
|
|
return token == null ? "" : token as string
|
|
}
|
|
|
|
/**
|
|
* 设置Token
|
|
*/
|
|
static setToken(token : string) : void {
|
|
uni.setStorageSync(Auth.TokenKey, token)
|
|
}
|
|
|
|
/**
|
|
* 删除Token
|
|
*/
|
|
static removeToken() : void {
|
|
uni.removeStorageSync(Auth.TokenKey)
|
|
}
|
|
} |