This commit is contained in:
itcsx committed 2026-09-22 15:59:05 +08:00
1 parent d5d4a6f3bf
commit fb1a79a3e9
27 files changed
+708 -75

No files matched your search

+7
View File
@@ -34,6 +34,13 @@ export const useLoginProfileStore = defineStore("loginProfile", {
updateJwtInfo(jwtInfo: JwtInfo) {
storage.set(JWT_STORAGE_ID, "Bearer " + jwtInfo.AccessToken);
storage.set(JWT_REFRESHKEY_STORAGE_ID, jwtInfo.RefreshToken);
// 同时同步内存里的登录信息:否则别处读 loginProfile.Token 拿到的还是旧令牌
if (this.loginProfile?.Token) {
this.loginProfile.Token.AccessToken = jwtInfo.AccessToken;
this.loginProfile.Token.RefreshToken = jwtInfo.RefreshToken;
this.loginProfile.Token.CreatedTime = jwtInfo.CreatedTime;
storage.set(LOGIN_PROFILE_STORAGE_ID, JSON.stringify(this.loginProfile));
}
},
getToken() {
return storage.get(JWT_STORAGE_ID);