refresh test
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -23,8 +23,7 @@ export const fetchMe = createServerFn()
|
||||
metadata: context.metadata
|
||||
};
|
||||
} catch (error: any) {
|
||||
// If getSessionContext throws (unauthenticated or redirect), return empty state
|
||||
logger.info('fetchMe: No authenticated user or redirect needed');
|
||||
logger.info('fetchMe: Session error', error.message);
|
||||
return { user: undefined, roles: [], metadata: {} };
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user