Fix error for non-registered order email notifications

main
Ashelyn Dawn 3 years ago
parent 190c547eda
commit ee74f7879e

@ -194,7 +194,10 @@ router.post('/:uuid/ship/tracking', ensureAdmin, parseJSON, async (req, res) =>
const order = await db.order.setTracking(req.params.uuid, req.body.code, req.body.date || null, req.body.price_cents)
const user = await db.order.getUser(order.uuid)
await email.sendShippingNotification(user, order)
// TODO: Handle sending email notifications to non-registered users
if(user)
await email.sendShippingNotification(user, order)
res.json(order)
})
@ -227,7 +230,10 @@ router.post('/:uuid/ship/easypost', ensureAdmin, parseJSON, async (req, res) =>
)
const user = await db.order.getUser(order.uuid)
await email.sendShippingNotification(user, updatedOrder)
// TODO: Handle sending email notifications to non-registered users
if(user)
await email.sendShippingNotification(user, updatedOrder)
res.json(updatedOrder)
})

Loading…
Cancel
Save