feat(SW-2547): filter out nonActive and nonPublished hotels and cities
This commit is contained in:
committed by
Michael Zetterberg
parent
814a1c534b
commit
e38fceb237
@@ -178,13 +178,11 @@ export async function getCountries({
|
||||
export async function getCitiesByCountry({
|
||||
countries,
|
||||
lang,
|
||||
onlyPublished = false,
|
||||
affix = locationsAffix,
|
||||
serviceToken,
|
||||
}: {
|
||||
countries: string[]
|
||||
lang: Lang
|
||||
onlyPublished?: boolean // false by default as it might be used in other places
|
||||
affix?: string
|
||||
serviceToken: string
|
||||
}): Promise<CitiesGroupedByCountry> {
|
||||
@@ -218,7 +216,6 @@ export async function getCitiesByCountry({
|
||||
console.error(citiesByCountry.error)
|
||||
throw new Error(`Unable to parse cities by country ${country}`)
|
||||
}
|
||||
|
||||
return { ...citiesByCountry.data, country }
|
||||
},
|
||||
"1d"
|
||||
@@ -228,9 +225,7 @@ export async function getCitiesByCountry({
|
||||
|
||||
const filteredCitiesByCountries = allCitiesByCountries.map((country) => ({
|
||||
...country,
|
||||
data: onlyPublished
|
||||
? country.data.filter((city) => city.isPublished)
|
||||
: country.data,
|
||||
data: country.data.filter((city) => city.isPublished),
|
||||
}))
|
||||
|
||||
const groupedCitiesByCountry: CitiesGroupedByCountry =
|
||||
|
||||
Reference in New Issue
Block a user