From 278a53a79f7f1f8d333bd892fd2054b2e56ea4a4 Mon Sep 17 00:00:00 2001 From: Timur Ercan Date: Tue, 28 Feb 2023 13:27:17 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20send=20complete=20mail=20before?= =?UTF-8?q?=20insert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web/pages/api/documents/[id]/sign.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/web/pages/api/documents/[id]/sign.ts b/apps/web/pages/api/documents/[id]/sign.ts index b88b13fa1..70a4b4a6a 100644 --- a/apps/web/pages/api/documents/[id]/sign.ts +++ b/apps/web/pages/api/documents/[id]/sign.ts @@ -90,7 +90,9 @@ async function postHandler(req: NextApiRequest, res: NextApiResponse) { select: { email: true, name: true }, }); - if (documentOwner) sendSigningDoneMail(recipient, document, documentOwner); + document.document = documentWithSignatureImages; + if (documentOwner) + await sendSigningDoneMail(recipient, document, documentOwner); } return res.status(200).end();