chore(console): i18n sync (#15360)
This commit is contained in:
parent
a3bdb974b3
commit
7f851da15e
32 changed files with 664 additions and 56 deletions
|
|
@ -2,15 +2,17 @@ import { redirect } from "@solidjs/router"
|
|||
import type { APIEvent } from "@solidjs/start/server"
|
||||
import { AuthClient } from "~/context/auth"
|
||||
import { useAuthSession } from "~/context/auth"
|
||||
import { i18n } from "~/i18n"
|
||||
import { localeFromRequest, route } from "~/lib/language"
|
||||
|
||||
export async function GET(input: APIEvent) {
|
||||
const url = new URL(input.request.url)
|
||||
const locale = localeFromRequest(input.request)
|
||||
const dict = i18n(locale)
|
||||
|
||||
try {
|
||||
const code = url.searchParams.get("code")
|
||||
if (!code) throw new Error("No code found")
|
||||
if (!code) throw new Error(dict["auth.callback.error.codeMissing"])
|
||||
const result = await AuthClient.exchange(code, `${url.origin}${url.pathname}`)
|
||||
if (result.err) throw new Error(result.err.message)
|
||||
const decoded = AuthClient.decode(result.tokens.access, {} as any)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue