Commit 96404848955f84d57b88dd240ab3a57b7017103c
1 parent
f87b0f2f
fix: fixed token clear error
修复将token设置为undefined时可能失败的问题
Showing
1 changed file
with
1 additions
and
1 deletions
src/store/modules/user.ts
@@ -58,7 +58,7 @@ export const useUserStore = defineStore({ | @@ -58,7 +58,7 @@ export const useUserStore = defineStore({ | ||
58 | }, | 58 | }, |
59 | actions: { | 59 | actions: { |
60 | setToken(info: string | undefined) { | 60 | setToken(info: string | undefined) { |
61 | - this.token = info; | 61 | + this.token = info ? info : ''; // for null or undefined value |
62 | setAuthCache(TOKEN_KEY, info); | 62 | setAuthCache(TOKEN_KEY, info); |
63 | }, | 63 | }, |
64 | setRoleList(roleList: RoleEnum[]) { | 64 | setRoleList(roleList: RoleEnum[]) { |