轮询修改,媒体过期判断
This commit is contained in:
@@ -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);
|
||||
}
|
||||
},
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user