refresh test

This commit is contained in:
yohlo
2025-09-13 00:50:41 -05:00
parent a926dcde07
commit 7d3c0a3fa4
6 changed files with 102 additions and 23 deletions

View File

@@ -34,7 +34,18 @@ export const useMe = () => {
queryFn,
options: {
staleTime: 0,
refetchOnMount: true
refetchOnMount: true,
retry: (failureCount, error: any) => {
if (error?.response?.status === 401) {
const errorData = error?.response?.data;
if (errorData?.error === "SESSION_REFRESH_REQUIRED") {
const currentUrl = window.location.pathname + window.location.search;
window.location.href = `/refresh-session?redirect=${encodeURIComponent(currentUrl)}`;
return false;
}
}
return failureCount < 3;
}
}
});
};