._.
This commit is contained in:
parent
514b773a90
commit
e648aeaea5
@ -36,9 +36,18 @@ const DeliveryOrderDetails = () => {
|
|||||||
setDeliveryAccessories(accessories);
|
setDeliveryAccessories(accessories);
|
||||||
|
|
||||||
const coords = await Promise.all(
|
const coords = await Promise.all(
|
||||||
accessories.map(async (accessory) => {
|
accessories.map(async (accessory) => {
|
||||||
const coords = await getCoordinates(accessory.city_name);
|
console.log(accessory);
|
||||||
return { city: accessory.city_name, ...coords };
|
if (accessory.latitude && accessory.longitude) {
|
||||||
|
return {
|
||||||
|
city: accessory.city_name,
|
||||||
|
latitude: accessory.latitude,
|
||||||
|
longitude: accessory.longitude,
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
const coords = await getCoordinates(accessory.city_name);
|
||||||
|
return { city: accessory.city_name, ...coords };
|
||||||
|
}
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
setCoordinates(coords);
|
setCoordinates(coords);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user