Fix: break out pages to dynamic route

This commit is contained in:
Christel Westerberg
2024-05-22 16:46:07 +02:00
parent ad5fb9c89d
commit c36578a83f
11 changed files with 78 additions and 51 deletions

View File

@@ -2,7 +2,6 @@ import { TRPCError } from "@trpc/server"
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 +23,6 @@ export function serverClient() {
if (error.code === "UNAUTHORIZED") {
const lang = ctx?.lang || Lang.en
if (ctx?.webToken) {
console.log({ ctx })
const returnUrl = ctx.url
const redirectUrl = `/${lang}/webview/refresh?returnurl=${encodeURIComponent(returnUrl)}`
@@ -35,8 +33,6 @@ export function serverClient() {
redirect(redirectUrl)
}
console.error("Unautorized on web, redirecting to login")
const pathname = ctx?.pathname || "/"
redirect(
`/${lang}/login?redirectTo=${encodeURIComponent(`/${lang}/${pathname}`)}`