dmikester1 – 18-12 Nov 23
I have this function in my React app that makes an api call that does some work that might take some time and I do not want to wait for it to finish.
const switchShifts = async () => {
console.log({ bagCounts });
const completedOrders = orders
.filter((o) => o.DATE_COMPLETED !== null)
.map((o) => {
return { orderID: o.ORDER_ID, GUID: o.ORDER_GUID };
});
completeOrdersInBC(completedOrders);
// more code to run down here without waiting for 'completeOrdersInBC'
...
}; const switchShifts = async () => {
console.log({ bagCounts });
const completedOrders = orders
.filter((o) => o.DATE_COMPLETED !== null)
.map((o) => {
return { orderID: o.ORDER_ID, GUID: o.ORDER_GUID };
});
completeOrdersInBC(completedOrders);
// more code to run down here without waiting for 'completeOrdersInBC'
...
};