fix: send searchparams in rewrite

This commit is contained in:
Christel Westerberg
2024-05-28 11:00:27 +02:00
parent 97db9f21b9
commit f04247ed43
4 changed files with 33 additions and 6 deletions

View File

@@ -1,7 +1,9 @@
import { TRPCError } from "@trpc/server"
import { redirect } from "next/navigation"
import { NextResponse } from "next/server"
import { Lang } from "@/constants/languages"
import { env } from "@/env/server"
import { appRouter } from "@/server"
import { createContext } from "@/server/context"
import { internalServerError } from "@/server/errors/next"
@@ -30,10 +32,12 @@ export function serverClient() {
"Unautorized in webview, redirecting to: ",
redirectUrl
)
redirect(redirectUrl)
}
const pathname = ctx?.pathname || "/"
redirect(
`/${lang}/login?redirectTo=${encodeURIComponent(`/${lang}/${pathname}`)}`
)