Skip to content

The Open Source DocuSign Alternative.

fix: await signing requests

Mythie6c78332258eb
diff --git a/apps/web/pages/api/documents/[id]/send.ts b/apps/web/pages/api/documents/[id]/send.ts
index ea3e91adc..b038fcc1e 100644
--- a/apps/web/pages/api/documents/[id]/send.ts
+++ b/apps/web/pages/api/documents/[id]/send.ts
@@ -48,11 +48,14 @@ async function postHandler(req: NextApiRequest, res: NextApiResponse) {
}
let sentRequests = 0;
- recipients.forEach(async (recipient) => {
- await sendSigningRequest(recipient, document, user);
- sentRequests++;
- });
+ await Promise.all(
+ recipients.map(async (recipient) => {
+ await sendSigningRequest(recipient, document, user);
+
+ sentRequests++;
+ })
+ );
if (sentRequests === recipients.length) {
return res.status(200).send(recipients.length);