Explorar el Código

fix: fixed token clear error

修复将token设置为undefined时可能失败的问题
无木 hace 3 años
padre
commit
9640484895
Se han modificado 1 ficheros con 1 adiciones y 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[]) {