fix: fixed token clear error

修复将token设置为undefined时可能失败的问题
This commit is contained in:
无木 2021-09-13 19:04:02 +08:00
parent f87b0f2f5e
commit 9640484895

View File

@ -58,7 +58,7 @@ export const useUserStore = defineStore({
}, },
actions: { actions: {
setToken(info: string | undefined) { setToken(info: string | undefined) {
this.token = info; this.token = info ? info : ''; // for null or undefined value
setAuthCache(TOKEN_KEY, info); setAuthCache(TOKEN_KEY, info);
}, },
setRoleList(roleList: RoleEnum[]) { setRoleList(roleList: RoleEnum[]) {