fix(frontend): hide logout outside local auth

This commit is contained in:
User
2026-08-22 19:43:42 +02:00
parent 309bc44d4a
commit 9c47fb5f3d
7 changed files with 92 additions and 15 deletions
+14 -3
View File
@@ -17,14 +17,20 @@ import { Button } from "../components/ui/button";
type GateStatus = "loading" | "login" | "authenticated" | "forbidden" | "unavailable";
function AuthenticatedContent({ onExpired }: { onExpired: () => void }) {
function AuthenticatedContent({
canLogout,
onExpired,
}: {
canLogout: boolean;
onExpired: () => void;
}) {
const user = useAuthUser();
const authGeneration = useAuthGeneration();
useEffect(() => {
if (!user) onExpired();
}, [onExpired, user]);
return user
? <AppShell key={`${user.issuer}:${user.subject}:${authGeneration}`} />
? <AppShell key={`${user.issuer}:${user.subject}:${authGeneration}`} canLogout={canLogout} />
: null;
}
@@ -77,7 +83,12 @@ export function AuthGate() {
}
if (status === "authenticated") {
return <AuthenticatedContent onExpired={() => setStatus("login")} />;
return (
<AuthenticatedContent
canLogout={config?.mode === "local"}
onExpired={() => setStatus("login")}
/>
);
}
if (status === "unavailable") {