轮询修改,媒体过期判断

This commit is contained in:
孙佳艺
2026-06-04 13:03:04 +08:00
parent 64f7069ae2
commit 450e509b1a
13 changed files with 1812 additions and 678 deletions
+10
View File
@@ -9,6 +9,7 @@ interface AuthState {
logout: () => Promise<void>;
checkAuth: () => Promise<void>;
changePassword: (oldPwd: string, newPwd: string) => Promise<void>;
refreshUser: () => Promise<void>;
}
export const useAuthStore = create<AuthState>((set) => ({
@@ -42,4 +43,13 @@ export const useAuthStore = create<AuthState>((set) => ({
changePassword: async (oldPwd, newPwd) => {
await api.changePassword(oldPwd, newPwd);
},
refreshUser: async () => {
try {
const user = await api.getUser();
set({ user });
} catch (error) {
console.error('Failed to refresh user:', error);
}
},
}));