diff options
| author | Dax Raad <[email protected]> | 2025-11-23 00:12:58 -0500 |
|---|---|---|
| committer | Dax Raad <[email protected]> | 2025-11-23 00:12:58 -0500 |
| commit | 448b72d046c131677ccd65a8099560f26f9d5018 (patch) | |
| tree | fac1b1380779dec2c5531643c93007765c2e8b53 /packages/console/app/src/routes/auth | |
| parent | d96d89bcb8fa146db7c14343423dad4e16ca0970 (diff) | |
| download | opencode-448b72d046c131677ccd65a8099560f26f9d5018.tar.gz opencode-448b72d046c131677ccd65a8099560f26f9d5018.zip | |
fix logout
Diffstat (limited to 'packages/console/app/src/routes/auth')
| -rw-r--r-- | packages/console/app/src/routes/auth/logout.ts | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/packages/console/app/src/routes/auth/logout.ts b/packages/console/app/src/routes/auth/logout.ts new file mode 100644 index 000000000..00a63f0c6 --- /dev/null +++ b/packages/console/app/src/routes/auth/logout.ts @@ -0,0 +1,21 @@ +import { redirect } from "@solidjs/router" +import { APIEvent } from "@solidjs/start" +import { getResponseHeaders } from "@solidjs/start/http" +import { useAuthSession } from "~/context/auth.session" + +export async function GET(event: APIEvent) { + const auth = await useAuthSession() + const current = auth.data.current + if (current) + await auth.update((val) => { + delete val.account?.[current] + const first = Object.keys(val.account ?? {})[0] + val.current = first + event!.locals.actor = undefined + return val + }) + return redirect("/zen", { + status: 302, + headers: getResponseHeaders(), + }) +} |
