Code: Select all
async function createOrder(){
try {
//Create the order object
const order = {
productid: 1234
name: "helpful text"
price: "55.00"
}
sendEmail(order); // I dont want to await this
return {
order // Client needs this ASAP without waiting for email to be sent
}
}
catch (e) {
console.error(e);
}
}
< /code>
Die E -Mail -Funktion sendet die Mail: < /p>
async function sendEmail(payload){
try {
await axios.post('/emailer/send', {
payload
});
}
catch(e){
console.error(e);
}
}