The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(dashboard): hide AuthWidget on 401 via ApiError status
Austin Pickett9d7a4ab71805
diff --git a/web/src/components/AuthWidget.tsx b/web/src/components/AuthWidget.tsxindex 2799bd7ee8b..4d5ec3a0443 100644--- a/web/src/components/AuthWidget.tsx+++ b/web/src/components/AuthWidget.tsx@@ -25,6 +25,7 @@import { useEffect, useState } from "react";import { api, type AuthMeResponse } from "@/lib/api";+import { ApiError } from "@/lib/api-error";import { shouldHideAuthWidget } from "./auth-widget-visibility";import { cn } from "@/lib/utils";import { LogOut } from "lucide-react";@@ -60,13 +61,12 @@ export function AuthWidget({ className }: AuthWidgetProps) {}).catch((err: unknown) => {if (cancelled) return;- // 401 from /api/auth/me means the gate isn't engaged in this- // process (loopback mode) — render nothing. fetchJSON throws an- // Error with the status code as a prefix; the global 401- // handler only redirects on the structured envelope, so a plain- // 401 from /api/auth/me with no envelope bubbles up here.- const msg = err instanceof Error ? err.message : String(err);- if (msg.startsWith("401:") || msg.startsWith("403:")) {+ // 401/403 from /api/auth/me means the gate isn't engaged in this+ // process (loopback mode) or the session is gone — render nothing.+ // fetchJSON throws an ApiError whose humanized message no longer+ // carries the status prefix, so read the status off the error+ // object itself.+ if (err instanceof ApiError && (err.status === 401 || err.status === 403)) {setHidden(true);return;}