From 3cacad2bab1642a11e2e36d9bf49d4112b1b03dd Mon Sep 17 00:00:00 2001 From: xlsea Date: Thu, 6 Jun 2024 18:04:29 +0800 Subject: [PATCH] =?UTF-8?q?fix(sj=5F1.0.0=5Fbeta4):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=91=BD=E5=90=8D=E7=A9=BA=E9=97=B4=E9=80=80=E5=87=BA=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E6=97=A0=E6=B3=95=E4=BF=9D=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/auth/index.ts | 5 ++++- src/store/modules/auth/shared.ts | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/store/modules/auth/index.ts b/src/store/modules/auth/index.ts index 7bd7c59..6015264 100644 --- a/src/store/modules/auth/index.ts +++ b/src/store/modules/auth/index.ts @@ -88,7 +88,10 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => { // 1. stored in the localStorage, the later requests need it in headers localStg.set('token', loginToken.token); // localStg.set('refreshToken', loginToken.refreshToken); - localStg.set('namespaceId', loginToken.namespaceIds[0].uniqueId); + const namespaceId = localStg.get('namespaceId'); + if (!namespaceId || !loginToken.namespaceIds.map(item => item.uniqueId.includes(namespaceId))) { + localStg.set('namespaceId', loginToken.namespaceIds[0].uniqueId); + } const { data: info, error } = await fetchGetUserInfo(); diff --git a/src/store/modules/auth/shared.ts b/src/store/modules/auth/shared.ts index 3cd8d3a..5d215c4 100644 --- a/src/store/modules/auth/shared.ts +++ b/src/store/modules/auth/shared.ts @@ -31,6 +31,6 @@ export function getUserInfo() { export function clearAuthStorage() { localStg.remove('token'); // localStg.remove('refreshToken'); - localStg.remove('namespaceId'); + // localStg.remove('namespaceId'); localStg.remove('userInfo'); }