fix(frontend): Handle 401 errors gracefully in onboarding provider

Silently handle 401 errors during onboarding initialization and step
completion. These errors are expected during login transitions when
auth cookies haven't propagated to the server-side proxy yet.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Swifty
2025-12-20 00:19:37 +01:00
parent 9e83985b5b
commit 84244c0b56

View File

@@ -161,6 +161,20 @@ export default function OnboardingProvider({
router.push("/marketplace");
}
} catch (error) {
// Silently handle 401 errors - these are expected during login transition
// when the auth cookies haven't propagated to the server yet
const isAuthError =
error &&
typeof error === "object" &&
"status" in error &&
(error as { status: number }).status === 401;
if (isAuthError) {
console.debug("Onboarding initialization skipped - auth not ready yet");
hasInitialized.current = false; // Allow retry on next render
return;
}
console.error("Failed to initialize onboarding:", error);
toast({
@@ -252,6 +266,18 @@ export default function OnboardingProvider({
await postV1CompleteOnboardingStep({ step });
await fetchOnboarding();
} catch (error) {
// Silently handle 401 errors - auth may not be ready yet
const isAuthError =
error &&
typeof error === "object" &&
"status" in error &&
(error as { status: number }).status === 401;
if (isAuthError) {
console.debug("Onboarding step completion skipped - auth not ready yet");
return;
}
if (isMounted.current) {
console.error("Failed to complete onboarding step:", error);
}