diff --git a/utils/Auth.uts b/utils/Auth.uts new file mode 100644 index 0000000..4e4e286 --- /dev/null +++ b/utils/Auth.uts @@ -0,0 +1,26 @@ +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) + } +} \ No newline at end of file