fix: enable benefits blocks

This commit is contained in:
Christel Westerberg
2024-05-16 17:01:16 +02:00
parent 9e4f41ee46
commit e195f70d79
4 changed files with 45 additions and 86 deletions

View File

@@ -1,8 +1,8 @@
import { TRPCError } from "@trpc/server"
import { headers } from "next/headers"
import { redirect } from "next/navigation"
import { Lang } from "@/constants/languages"
import { overview } from "@/constants/routes/webviews"
import { appRouter } from "@/server"
import { createContext } from "@/server/context"
import { internalServerError } from "@/server/errors/next"
@@ -24,7 +24,9 @@ export function serverClient() {
if (error.code === "UNAUTHORIZED") {
const lang = ctx?.lang || Lang.en
if (ctx?.webToken) {
const returnUrl = ctx.url
console.log({ ctx })
const returnUrl = ctx.pathname || overview[lang]
const redirectUrl = `/${lang}/webview/refresh?returnurl=${encodeURIComponent(returnUrl)}`
console.error(
"Unautorized in webview, redirecting to: ",