Download packages/console/app/src/routes/auth/logout.ts from SaylorTwift/opencode: direct link, hf CLI and curl.
- Browser
- Download file 507 Bytes
-
https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/console/app/src/routes/auth/logout.ts
- Command line
-
hf download hf://SaylorTwift/opencode/packages/console/app/src/routes/auth/logout.ts
-
curl -L -o logout.ts https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/console/app/src/routes/auth/logout.ts
507 Bytes
| import { redirect } from "@solidjs/router" | |
| import { APIEvent } from "@solidjs/start" | |
| import { useAuthSession } from "~/context/auth" | |
| 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") | |
| } | |