From 1fc1ad5635c667c5b1abdae32a6538b051e31d1d Mon Sep 17 00:00:00 2001 From: Rassl Date: Tue, 14 Apr 2026 00:08:02 +0400 Subject: [PATCH] feat: fix admin flow --- src/components/auth/auth-guard.tsx | 14 +++++++++++--- src/lib/sphinx/bridge.ts | 2 ++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/components/auth/auth-guard.tsx b/src/components/auth/auth-guard.tsx index ba31bcc3..d22f701b 100644 --- a/src/components/auth/auth-guard.tsx +++ b/src/components/auth/auth-guard.tsx @@ -92,9 +92,17 @@ export function AuthGuard({ children }: { children: React.ReactNode }) { return } - await handleAuth() - await Promise.all([handleIsAdmin(), fetchGraphMeta()]) - setLoading(false) + try { + console.log("[auth] starting handleAuth...") + await handleAuth() + console.log("[auth] handleAuth done, starting isAdmin + graphMeta...") + await Promise.all([handleIsAdmin(), fetchGraphMeta()]) + console.log("[auth] all done") + } catch (err) { + console.error("[auth] init failed:", err) + } finally { + setLoading(false) + } } init() }, [handleAuth, handleIsAdmin, fetchGraphMeta, setIsAdmin, setIsAuthenticated, setBudget, setGraphMeta]) diff --git a/src/lib/sphinx/bridge.ts b/src/lib/sphinx/bridge.ts index c0438347..95089589 100644 --- a/src/lib/sphinx/bridge.ts +++ b/src/lib/sphinx/bridge.ts @@ -64,7 +64,9 @@ export async function getL402(): Promise { if (!isSphinx()) return "" try { + console.log("[getL402] calling sphinx.getLsat...") const token = await sphinx.getLsat(window.location.host) + console.log("[getL402] sphinx.getLsat result:", token ? "got token" : "no token") if (token?.macaroon) { localStorage.setItem( "l402",