feat(BOOK-463): Fetching hotel filters from CMS and using these inside the destination pages and select hotel page
* feat(BOOK-463): Fetching hotel filters from CMS and using these inside the destination pages * fix(BOOK-698): fetch hotel filters from CMS on select hotel page Approved-by: Bianca Widstam
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import { FacilityEnum } from "@scandic-hotels/common/constants/facilities"
|
||||
import { isDefined } from "@scandic-hotels/common/utils/isDefined"
|
||||
|
||||
import { DestinationFilterBlocksEnum } from "../../../types/destinationsData"
|
||||
import { discriminatedUnionArray } from "../../../utils/discriminatedUnion"
|
||||
import { hotelFilterSchema } from "../../hotels/filters/output"
|
||||
import { accordionSchema } from "./blocks/accordion"
|
||||
import { contentSchema } from "./blocks/content"
|
||||
import { systemSchema } from "./system"
|
||||
@@ -37,12 +37,7 @@ export const destinationFilterSchema = z.object({
|
||||
filterConnection: z.object({
|
||||
edges: z.array(
|
||||
z.object({
|
||||
node: z.object({
|
||||
title: z.string(),
|
||||
facility_id: z.nativeEnum(FacilityEnum).catch(FacilityEnum.UNKNOWN),
|
||||
category: z.string(),
|
||||
slug: z.string(),
|
||||
}),
|
||||
node: hotelFilterSchema,
|
||||
})
|
||||
),
|
||||
}),
|
||||
@@ -84,13 +79,7 @@ export function transformDestinationFiltersResponse(
|
||||
heading,
|
||||
preamble,
|
||||
blocks,
|
||||
filter: {
|
||||
id: filter.facility_id,
|
||||
name: filter.title,
|
||||
filterType: filter.category,
|
||||
slug: filter.slug,
|
||||
sortOrder: 0,
|
||||
},
|
||||
filter,
|
||||
}
|
||||
})
|
||||
.filter(isDefined)
|
||||
|
||||
Reference in New Issue
Block a user