Explorar o código

fix: fixed token clear error

修复将token设置为undefined时可能失败的问题
无木 %!s(int64=3) %!d(string=hai) anos
pai
achega
9640484895
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      src/store/modules/user.ts

+ 1 - 1
src/store/modules/user.ts

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