diff --git a/src/routes/api/[slug]/+server.js b/src/routes/api/[slug]/+server.js index a7dcebbc28ca9c89057cb636a9fcc24d74b1f8be..c49ead2686aff7320b627bab8d1876c3a8a67fc6 100644 --- a/src/routes/api/[slug]/+server.js +++ b/src/routes/api/[slug]/+server.js @@ -89,6 +89,12 @@ export async function POST(event) { }else if(!result){ return new Response(JSON.stringify({message: "Invalid voucher"}), {headers: {'content-type': 'application/json', 'status': 400}}); } + // no need to await + sendNotification(event.locals.user, NotificationType.USE_VOUCHER, { + voucher: {code: result.code, value: result.amount}, + balanceBefore: event.locals.user.balance, + balanceAfter: event.locals.user.balance + result.amount + }); return new Response(JSON.stringify(result), {headers: {'content-type': 'application/json', 'status': 200}}); }catch(e){ console.error(e);