From 15cd0d2a7b6885ba010349332f39b37075d719d0 Mon Sep 17 00:00:00 2001 From: Timur Ercan Date: Sat, 18 Feb 2023 13:19:37 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web/pages/api/documents/[id]/send.ts | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/apps/web/pages/api/documents/[id]/send.ts b/apps/web/pages/api/documents/[id]/send.ts index 64e3d34fd..27f935001 100644 --- a/apps/web/pages/api/documents/[id]/send.ts +++ b/apps/web/pages/api/documents/[id]/send.ts @@ -36,17 +36,14 @@ async function postHandler(req: NextApiRequest, res: NextApiResponse) { if (!recipients.length) return res.status(200).end(""); - (await recipients).forEach(async (recipient) => { - await sendSigningRequest(recipient, document, user) - .then(() => { - return res.status(200).end(); - }) - .catch((err) => { - console.log(err); - return res.status(502).end("Coud not send request for signing."); - }); + recipients.forEach(async (recipient) => { + await sendSigningRequest(recipient, document, user).catch((err) => { + console.log(err); + return res.status(502).end("Coud not send request for signing."); + }); }); + return res.status(202).end(); // todo check if recipient has an account and show them in their inbox or something }