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,16 +1,13 @@
|
||||
import { ApiCountry } from "../../../types/country"
|
||||
import { HotelSortOption } from "../../../types/hotel"
|
||||
import {
|
||||
getFiltersFromHotels,
|
||||
mergeHotelFiltersAndSeoFilters,
|
||||
} from "../../../utils/getFiltersFromHotels"
|
||||
import { getSortedCities } from "../../../utils/getSortedCities"
|
||||
import { mergeHotelFiltersAndSeoFilters } from "../../../utils/mergeHotelFiltersAndSeoFilters"
|
||||
import { getHotelFilters } from "../../hotels/filters/utils"
|
||||
import {
|
||||
getCityByCityIdentifier,
|
||||
getHotelIdsByCityIdentifier,
|
||||
} from "../../hotels/services/getCityByCityIdentifier"
|
||||
import { getHotelIdsByCountry } from "../../hotels/services/getHotelIdsByCountry"
|
||||
import { getHotelsByHotelIds } from "../../hotels/services/getHotelsByHotelIds"
|
||||
import { getCityPages } from "../destinationCountryPage/utils"
|
||||
import { transformDestinationFiltersResponse } from "../schemas/destinationFilters"
|
||||
|
||||
@@ -62,11 +59,9 @@ export async function getCityData(
|
||||
serviceToken
|
||||
)
|
||||
|
||||
const hotels = await getHotelsByHotelIds({ hotelIds, lang, serviceToken })
|
||||
|
||||
let filterType
|
||||
if (filter) {
|
||||
const hotelFilters = getFiltersFromHotels(hotels, lang)
|
||||
const hotelFilters = await getHotelFilters(lang)
|
||||
const allFilters = mergeHotelFiltersAndSeoFilters(
|
||||
hotelFilters,
|
||||
seoFilters
|
||||
@@ -104,6 +99,7 @@ export async function getCountryData(
|
||||
lang: Lang
|
||||
) {
|
||||
const country = data.destination_settings?.country
|
||||
const seoFilters = transformDestinationFiltersResponse(data.seo_filters)
|
||||
const filter = input.filterFromUrl
|
||||
|
||||
if (country) {
|
||||
@@ -117,10 +113,13 @@ export async function getCountryData(
|
||||
serviceToken,
|
||||
})
|
||||
|
||||
const hotels = await getHotelsByHotelIds({ hotelIds, lang, serviceToken })
|
||||
|
||||
if (filter) {
|
||||
const allFilters = getFiltersFromHotels(hotels, lang)
|
||||
const hotelFilters = await getHotelFilters(lang)
|
||||
const allFilters = mergeHotelFiltersAndSeoFilters(
|
||||
hotelFilters,
|
||||
seoFilters
|
||||
)
|
||||
|
||||
const facilityFilter = allFilters.facilityFilters.find(
|
||||
(f) => f.slug === filter
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user