This commit is contained in:
2025-04-10 02:14:32 +08:00
parent f8af24506b
commit 8b4312782d
2 changed files with 20 additions and 1 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "@kevisual/query-login",
"version": "0.0.3",
"version": "0.0.4",
"description": "",
"main": "dist/query-login.js",
"types": "dist/query-login.d.ts",

View File

@@ -274,6 +274,25 @@ export class QueryLogin {
},
);
}
/**
* 检查本地用户如果本地用户存在则返回本地用户否则返回null
* @returns
*/
async checkLocalUser() {
const user = await this.cacheStore.getCurrentUser();
if (user) {
return user;
}
return null;
}
/**
* 检查本地token是否存在简单的判断是否已经属于登陆状态
* @returns
*/
async checkLocalToken() {
const token = this.storage.getItem('token');
return !!token;
}
/**
* 请求更新,切换用户, 使用switchUser
* @param username