Merged in fix/nullcheck-gethotelpins (pull request #1296)
fix: getHotelPins - null check on hotelData * fix: getHotelPins - null check on hotelData Approved-by: Pontus Dreij
This commit is contained in:
@@ -4,7 +4,9 @@ import type { HotelPin } from "@/types/components/hotelReservation/selectHotel/m
|
|||||||
export function getHotelPins(hotels: HotelData[]): HotelPin[] {
|
export function getHotelPins(hotels: HotelData[]): HotelPin[] {
|
||||||
if (hotels.length === 0) return []
|
if (hotels.length === 0) return []
|
||||||
|
|
||||||
return hotels.map((hotel) => ({
|
return hotels
|
||||||
|
.filter((hotel) => hotel.hotelData)
|
||||||
|
.map((hotel) => ({
|
||||||
coordinates: {
|
coordinates: {
|
||||||
lat: hotel.hotelData.location.latitude,
|
lat: hotel.hotelData.location.latitude,
|
||||||
lng: hotel.hotelData.location.longitude,
|
lng: hotel.hotelData.location.longitude,
|
||||||
|
|||||||
Reference in New Issue
Block a user