Skip to content

Commit f256a65

Browse files
committed
fix: auth routing
1 parent 6a5c1a7 commit f256a65

3 files changed

Lines changed: 4 additions & 5 deletions

File tree

packages/console/app/src/lib/language.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ export function strip(pathname: string) {
9191
export function route(locale: Locale, pathname: string) {
9292
const next = strip(pathname)
9393
if (next.startsWith("/docs")) return next
94+
if (next.startsWith("/auth")) return next
95+
if (next.startsWith("/workspace")) return next
9496
if (locale === "en") return next
9597
if (next === "/") return `/${locale}`
9698
return `/${locale}${next}`

packages/console/app/src/routes/auth/[...callback].ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { redirect } from "@solidjs/router"
22
import type { APIEvent } from "@solidjs/start/server"
33
import { AuthClient } from "~/context/auth"
44
import { useAuthSession } from "~/context/auth"
5-
import { fromPathname, localeFromRequest, route } from "~/lib/language"
5+
import { localeFromRequest, route } from "~/lib/language"
66

77
export async function GET(input: APIEvent) {
88
const url = new URL(input.request.url)
@@ -31,7 +31,6 @@ export async function GET(input: APIEvent) {
3131
}
3232
})
3333
const next = url.pathname === "/auth/callback" ? "/auth" : url.pathname.replace("/auth/callback", "")
34-
if (fromPathname(next)) return redirect(next)
3534
return redirect(route(locale, next))
3635
} catch (e: any) {
3736
return new Response(

packages/console/app/src/routes/auth/index.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ export async function GET(input: APIEvent) {
99
const workspaceID = await getLastSeenWorkspaceID()
1010
return redirect(route(locale, `/workspace/${workspaceID}`))
1111
} catch {
12-
const cont = route(locale, "/auth")
13-
if (cont === "/auth") return redirect("/auth/authorize")
14-
return redirect(`/auth/authorize?continue=${encodeURIComponent(cont)}`)
12+
return redirect("/auth/authorize")
1513
}
1614
}

0 commit comments

Comments
 (0)