send signing request

This commit is contained in:
Timur Ercan
2023-02-07 12:02:57 +01:00
parent b095733a9d
commit 554c641201
3 changed files with 16 additions and 2 deletions

View File

@ -39,6 +39,7 @@ async function postHandler(req: NextApiRequest, res: NextApiResponse) {
res.status(200).end();
})
.catch((err) => {
console.log(err);
return res.status(502).end("Coud not send request for signing.");
});
});

View File

@ -60,8 +60,7 @@ const RecipientsPage: NextPageWithLayout = (props: any) => {
color="primary"
icon={PaperAirplaneIcon}
onClick={() => {
alert();
// todo do stuff
send(props.document);
}}
disabled={(props?.document?.Recipient?.length || 0) === 0}
>
@ -266,4 +265,17 @@ export async function getServerSideProps(context: any) {
};
}
async function send(document: any) {
// todo toast
// loading
if (!document || !document.id) return;
await fetch(`/api/documents/${document.id}/send`, {
body: "",
headers: {
"Content-Type": "application/json",
},
method: "POST",
});
}
export default RecipientsPage;