mailing template and send sign request error handling

This commit is contained in:
Timur Ercan
2023-01-30 20:27:32 +01:00
parent 8fa7aa5cbd
commit 2a1d08e3fd
6 changed files with 96 additions and 95 deletions

View File

@ -42,17 +42,20 @@ async function postHandler(req: NextApiRequest, res: NextApiResponse) {
const recipients = prisma.recipient.findMany({
where: {
documentId: +documentId,
sendStatus: SendStatus.NOT_SENT, // TODO REDO AFTER DEBUG
// sendStatus: SendStatus.NOT_SENT, // TODO REDO AFTER DEBUG
},
});
(await recipients).forEach(async (recipient) => {
await sendSigningRequest(recipient, document)
.then(() => {
res.status(200).end();
})
.catch((err) => {
return res.status(502).end("Coud not send request for signing.");
});
});
// todo check if recipient has an account and show them in their inbox or something
(await recipients).forEach(async (recipient) => {
await sendSigningRequest(recipient, document);
});
// todo way better error handling
return res.status(200).end();
}
export default defaultHandler({