i'm using the following code to send two specific emails, one for the reservation client and other for me:
sendgrid.send({
to: "[email protected]",
from: "[email protected]",
subject: "Register confirmation",
html: "Some HTML",
},
function(err, json) {
if (err) {
return console.error(err);
}
else {
next();
}
});
sendgrid.send({
to: "[email protected]",
from: "[email protected]",
subject: "NEW RESERVATION!",
html: "SOME TEXT OR HTML",
},
function(err, json) {
if (err) {
return console.error(err);
}
else {
next();
}
});
Can i improve this? There is some much duplication.