feat(SW-664): Hotel listing component and queries for content pages
This commit is contained in:
@@ -2,6 +2,8 @@ import { z } from "zod"
|
||||
|
||||
import { discriminatedUnionArray } from "@/lib/discriminatedUnion"
|
||||
|
||||
import { removeMultipleSlashes } from "@/utils/url"
|
||||
|
||||
import {
|
||||
activitiesCardRefSchema,
|
||||
activitiesCardSchema,
|
||||
@@ -58,3 +60,26 @@ export const hotelPageRefsSchema = z.object({
|
||||
url: z.string(),
|
||||
}),
|
||||
})
|
||||
|
||||
export const hotelPageUrlSchema = z
|
||||
.object({
|
||||
all_hotel_page: z.object({
|
||||
items: z
|
||||
.array(
|
||||
z.object({
|
||||
url: z.string(),
|
||||
system: systemSchema,
|
||||
})
|
||||
)
|
||||
.max(1),
|
||||
}),
|
||||
})
|
||||
.transform((data) => {
|
||||
const page = data.all_hotel_page.items[0]
|
||||
if (!page) {
|
||||
return null
|
||||
}
|
||||
|
||||
const lang = page.system.locale
|
||||
return removeMultipleSlashes(`/${lang}/${page.url}`)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user