mirror of
https://github.com/sst/opencode.git
synced 2025-12-23 10:11:41 +00:00
fix auth
This commit is contained in:
parent
c2bf6975f8
commit
2b014fcd75
3 changed files with 14 additions and 1 deletions
1
bun.lock
1
bun.lock
|
|
@ -33,6 +33,7 @@
|
|||
"@solidjs/router": "catalog:",
|
||||
"@solidjs/start": "catalog:",
|
||||
"chart.js": "4.5.1",
|
||||
"h3": "2.0.1-rc.4",
|
||||
"nitro": "3.0.1-alpha.1",
|
||||
"solid-js": "catalog:",
|
||||
"vite": "catalog:",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { redirect } from "@solidjs/router"
|
||||
import { getResponseHeaders } from "@solidjs/start/http"
|
||||
import type { APIEvent } from "@solidjs/start/server"
|
||||
import { AuthClient } from "~/context/auth"
|
||||
import { useAuthSession } from "~/context/auth.session"
|
||||
|
|
@ -19,6 +20,7 @@ export async function GET(input: APIEvent) {
|
|||
return {
|
||||
...value,
|
||||
account: {
|
||||
...value.account,
|
||||
[id]: {
|
||||
id,
|
||||
email: decoded.subject.properties.email,
|
||||
|
|
@ -27,5 +29,8 @@ export async function GET(input: APIEvent) {
|
|||
current: id,
|
||||
}
|
||||
})
|
||||
return redirect("/auth")
|
||||
return redirect("/auth/status", {
|
||||
status: 302,
|
||||
headers: getResponseHeaders(),
|
||||
})
|
||||
}
|
||||
|
|
|
|||
7
packages/console/app/src/routes/auth/status.ts
Normal file
7
packages/console/app/src/routes/auth/status.ts
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import { APIEvent } from "@solidjs/start"
|
||||
import { useAuthSession } from "~/context/auth.session"
|
||||
|
||||
export async function GET(input: APIEvent) {
|
||||
const session = await useAuthSession()
|
||||
return Response.json(session.data)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue