fix logout

This commit is contained in:
Dax Raad
2025-11-23 00:12:58 -05:00
parent d96d89bcb8
commit 448b72d046
3 changed files with 27 additions and 12 deletions

View File

@@ -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(),
})
}