소스 검색

refactor: move cleanup to finally block

eric 5 달 전
부모
커밋
694396dcfb
1개의 변경된 파일3개의 추가작업 그리고 3개의 파일을 삭제
  1. 3 3
      playground/src/store/auth.ts

+ 3 - 3
playground/src/store/auth.ts

@@ -86,13 +86,13 @@ export const useAuthStore = defineStore('auth', () => {
 
     try {
       await logoutApi();
-
-      resetAllStores();
-      accessStore.setLoginExpired(false);
     } catch {
       // 不做任何处理
     } finally {
       isLoggingOut.value = false; // 重置 标识
+
+      resetAllStores();
+      accessStore.setLoginExpired(false);
     }
 
     // 回登录页带上当前路由地址