fix: resolve variable hoisting and add auth debug logs

This commit is contained in:
dyzulk
2026-01-06 02:51:27 +07:00
parent 8195de344d
commit c98ca995e9

View File

@@ -16,11 +16,12 @@ export const useAuth = ({ middleware, redirectIfAuthenticated }: { middleware?:
}), }),
{ {
shouldRetryOnError: (error) => { shouldRetryOnError: (error) => {
// Never retry on 401 Unauthorized or 409 Conflict const status = error?.response?.status;
if (error.response?.status === 401 || error.response?.status === 409) { if (status === 401 || status === 409) {
console.log('[useAuth] Blocking retry for status:', status);
return false; return false;
} }
// Retry for other errors (network issues, 500s) console.log('[useAuth] Retrying for error:', error);
return true; return true;
} }
} }