Skip to content

Commit 85ae0ed

Browse files
committed
small fix
1 parent 13eb077 commit 85ae0ed

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

client/src/lib/hooks/useConnection.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -428,19 +428,18 @@ export function useConnection({
428428
error,
429429
);
430430

431-
// Check for auth-related errors
431+
const shouldRetry = await handleAuthError(error);
432+
if (shouldRetry) {
433+
return connect(undefined, retryCount + 1);
434+
}
432435
const is401Error =
433436
(error instanceof SseError && error.code === 401) ||
434437
(error instanceof Error && error.message.includes('401')) ||
435438
(error instanceof Error && error.message.includes('Unauthorized'));
436439

437440
if (is401Error) {
438-
console.log("Detected 401 error, attempting OAuth flow");
439-
const shouldRetry = await handleAuthError(error);
440-
if (shouldRetry) {
441-
return connect(undefined, retryCount + 1);
442-
}
443441
// Don't set error state if we're about to redirect for auth
442+
444443
return;
445444
}
446445
throw error;

0 commit comments

Comments
 (0)