feat(SW-1273): find my booking page with rudimentary validation and redirect
This commit is contained in:
@@ -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 }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user