fix(auth): make things work
This commit is contained in:
@@ -6,6 +6,7 @@ export namespace endpoints {
|
||||
profile = "profile/v0/Profile",
|
||||
}
|
||||
export const enum v1 {
|
||||
profile = "profile/v1/Profile",
|
||||
upcomingStays = "booking/v1/Stays/future",
|
||||
previousStays = "booking/v1/Stays/past",
|
||||
}
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
#import "../Fragments/Refs/System.graphql"
|
||||
|
||||
query ResolveEntryByUrl($locale: String!, $url: String!) {
|
||||
all_account_page(where: { url: $url }, locale: $locale) {
|
||||
items {
|
||||
system {
|
||||
...System
|
||||
}
|
||||
}
|
||||
total
|
||||
}
|
||||
all_content_page(where: { url: $url }, locale: $locale) {
|
||||
items {
|
||||
system {
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
@@ -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}`)}`
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user