feat(SW-1273): find my booking page with rudimentary validation and redirect

This commit is contained in:
Christian Andolf
2025-02-25 15:27:40 +01:00
parent 7711f78ab3
commit 85cd815968
19 changed files with 324 additions and 5 deletions

View File

@@ -1,6 +1,7 @@
import { metrics } from "@opentelemetry/api"
import { Lang } from "@/constants/languages"
import { findMyBooking } from "@/constants/myBooking"
import { baseUrls } from "@/constants/routes/baseUrls"
import { batchRequest } from "@/lib/graphql/batchRequest"
import {
@@ -179,6 +180,18 @@ export const languageSwitcherQueryRouter = router({
}
if (!uid || !lang) {
// we have pages that are not currently routed within contentstack context,
// therefor this fix is needed for some of these pages
if (input && Object.values(findMyBooking).includes(input.pathName)) {
const urls: Record<string, { url: string }> = {}
return {
lang,
urls: Object.entries(findMyBooking).reduce((acc, [lang, url]) => {
acc[lang] = { url }
return urls
}, urls),
}
}
return { lang: lang, urls: baseUrls }
}