refactored some code

This commit is contained in:
Jelaletdin12 committed 2025-12-24 22:04:44 +05:00
1 parent 342fb31906
commit 7538bdb813
12 files changed
+197 -111

No files matched your search

-9
View File
@@ -222,25 +222,16 @@ export function useLogout() {
try {
await apiClient.post("/auth/logout", {}, { timeout: 5000 });
} catch (error) {
// Logout should succeed even if server call fails
console.warn("[Logout] Server call failed, clearing local state anyway");
}
},
onSuccess: () => {
TokenStorage.clearTokens();
queryClient.clear();
if (typeof window !== "undefined") {
window.location.href = "/";
}
},
onError: () => {
TokenStorage.clearTokens();
queryClient.clear();
if (typeof window !== "undefined") {
window.location.href = "/";
}
},
});
}