Merged in fix/SW-236-webview-refresh-token (pull request #426)

fix(SW-236): add returnUrl to refresh

Approved-by: Pontus Dreij
This commit is contained in:
Michael Zetterberg
2024-08-21 07:19:38 +00:00

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)}`
)
}
}