소스 검색

fix: fixed token clear error

修复将token设置为undefined时可能失败的问题
无木 3 년 전
부모
커밋
9640484895
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  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[]) {