fix(SW-236): add returnUrl to refresh

This commit is contained in:
Michael Zetterberg
2024-08-20 15:02:02 +02:00
parent aa9e723cb5
commit 32aa6cf273

View File

@@ -1,3 +1,4 @@
import { headers } from "next/headers"
import { notFound, redirect } from "next/navigation"
import { serverClient } from "@/lib/trpc/server"
@@ -28,7 +29,11 @@ export default async function ContentTypePage({
case "unauthorized": // fall through
case "forbidden": // fall through
case "token_expired":
redirect(`/${getLang()}/webview/refresh`)
const h = headers()
const returnURL = `/${getLang()}/webview${h.get("x-pathname")!}`
redirect(
`/${getLang()}/webview/refresh?returnUrl=${encodeURIComponent(returnURL)}`
)
}
}