fix: resolve build errors, disable strict linting, and robust 401 handling

This commit is contained in:
dyzulk
2026-01-05 23:42:48 +07:00
parent cc921a91e1
commit 8195de344d
6 changed files with 406 additions and 43 deletions

View File

@@ -15,18 +15,13 @@ export const useAuth = ({ middleware, redirectIfAuthenticated }: { middleware?:
router.push('/verify-email');
}),
{
onErrorRetry: (error, key, config, revalidate, { retryCount }) => {
// Never retry on 401 Unauthorized
if (error.response?.status === 401) return;
// Never retry on 409 Conflict (handled by catch block above)
if (error.response?.status === 409) return;
// Only retry up to 3 times for other errors
if (retryCount >= 3) return;
// Retry after 5 seconds
setTimeout(() => revalidate({ retryCount }), 5000);
shouldRetryOnError: (error) => {
// Never retry on 401 Unauthorized or 409 Conflict
if (error.response?.status === 401 || error.response?.status === 409) {
return false;
}
// Retry for other errors (network issues, 500s)
return true;
}
}
);