项目里程碑初步优化

This commit is contained in:
Cheng Zhou
2026-02-27 09:06:06 +08:00
parent 8f3f717e48
commit fd7e3fc948
47 changed files with 2029 additions and 783 deletions
+7 -2
View File
@@ -22,7 +22,10 @@ export const useAuthStore = defineStore("auth", () => {
// 避免锁屏态下 fetchMe 被请求拦截
useSessionStore().unlock();
localStorage.setItem(LAST_LOGIN_EMAIL_KEY, email);
await fetchMeAction();
const me = await fetchMeAction();
const studyStore = useStudyStore();
const userKey = me?.email || email;
await studyStore.restoreStudyForUser(userKey, { preferActive: me?.role === "ADMIN" });
forceLogin.value = false;
} finally {
loading.value = false;
@@ -39,11 +42,13 @@ export const useAuthStore = defineStore("auth", () => {
};
const logout = () => {
const studyStore = useStudyStore();
const userKey = user.value?.email || localStorage.getItem(LAST_LOGIN_EMAIL_KEY) || "";
studyStore.rememberCurrentStudyForUser(userKey);
token.value = null;
user.value = null;
forceLogin.value = false;
clearToken();
const studyStore = useStudyStore();
studyStore.clearCurrentStudy();
};