Procházet zdrojové kódy

fix: fixed token clear error

修复将token设置为undefined时可能失败的问题
无木 před 3 roky
rodič
revize
9640484895
1 změnil soubory, kde provedl 1 přidání a 1 odebrání
  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[]) {