From 93f2805bc2737cd6f69d2f077e7814f63e9250cf Mon Sep 17 00:00:00 2001 From: Frank Date: Wed, 3 Sep 2025 06:37:40 -0400 Subject: [PATCH] wip: console --- cloud/app/src/context/auth.session.ts | 2 +- cloud/app/src/context/auth.ts | 5 +---- cloud/app/src/routes/index.tsx | 2 -- cloud/app/src/routes/workspace.tsx | 10 ++++++---- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/cloud/app/src/context/auth.session.ts b/cloud/app/src/context/auth.session.ts index c4b3940a..609bc364 100644 --- a/cloud/app/src/context/auth.session.ts +++ b/cloud/app/src/context/auth.session.ts @@ -1,7 +1,7 @@ import { useSession } from "vinxi/http" export interface AuthSession { - account: Record< + account?: Record< string, { id: string diff --git a/cloud/app/src/context/auth.ts b/cloud/app/src/context/auth.ts index 5f564299..ef81cccf 100644 --- a/cloud/app/src/context/auth.ts +++ b/cloud/app/src/context/auth.ts @@ -20,13 +20,10 @@ export const getActor = async (): Promise => { if (!evt) throw new Error("No request event") const url = new URL(evt.request.headers.has("x-server-id") ? evt.request.headers.get("referer")! : evt.request.url) const auth = await useAuthSession() + auth.data.account = auth.data.account ?? {} const splits = url.pathname.split("/").filter(Boolean) if (splits[0] !== "workspace") { - // TODO - console.log("before current") - console.log(`current: ${auth.data.current}`) const current = auth.data.account[auth.data.current ?? ""] - console.log("after current") if (current) { return { type: "account", diff --git a/cloud/app/src/routes/index.tsx b/cloud/app/src/routes/index.tsx index f9c0dc97..29f417e5 100644 --- a/cloud/app/src/routes/index.tsx +++ b/cloud/app/src/routes/index.tsx @@ -24,8 +24,6 @@ function CopyStatus() { const isLoggedIn = query(async () => { "use server" const actor = await getActor() - // TODO - console.log(actor) if (actor.type === "account") { const workspaces = await withActor(() => Account.workspaces()) return workspaces[0].id diff --git a/cloud/app/src/routes/workspace.tsx b/cloud/app/src/routes/workspace.tsx index 5149954f..853cb370 100644 --- a/cloud/app/src/routes/workspace.tsx +++ b/cloud/app/src/routes/workspace.tsx @@ -22,8 +22,8 @@ const logout = action(async () => { const current = auth.data.current if (current) await auth.update((val) => { - delete val.account[current] - const first = Object.keys(val.account)[0] + delete val.account?.[current] + const first = Object.keys(val.account ?? {})[0] val.current = first return val }) @@ -43,8 +43,10 @@ export default function WorkspaceLayout(props: RouteSectionProps) {
{userInfo()?.user.email} -
location.href = "/"} action={logout} method="post"> - + (location.href = "/")} action={logout} method="post"> +