fix(auth): make things work

This commit is contained in:
Michael Zetterberg
2024-05-20 09:05:49 +02:00
parent c4912bbb94
commit 476e9f7582
19 changed files with 122 additions and 82 deletions

View File

@@ -5,7 +5,7 @@ import {
QueryClient,
QueryClientProvider,
} from "@tanstack/react-query"
import { httpBatchLink, loggerLink,TRPCClientError } from "@trpc/client"
import { httpBatchLink, loggerLink, TRPCClientError } from "@trpc/client"
import { AnyTRPCRouter } from "@trpc/server"
import { useState } from "react"

View File

@@ -23,7 +23,9 @@ export function serverClient() {
if (error.code === "UNAUTHORIZED") {
const lang = ctx?.lang || Lang.en
const pathname = ctx?.pathname || "/"
redirect(`/${lang}/login?redirectTo=${encodeURIComponent(pathname)}`)
redirect(
`/${lang}/login?redirectTo=${encodeURIComponent(`/${lang}/${pathname}`)}`
)
}
}