mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 08:13:56 +10:00
send signing request
This commit is contained in:
@ -39,6 +39,7 @@ async function postHandler(req: NextApiRequest, res: NextApiResponse) {
|
|||||||
res.status(200).end();
|
res.status(200).end();
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
console.log(err);
|
||||||
return res.status(502).end("Coud not send request for signing.");
|
return res.status(502).end("Coud not send request for signing.");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -60,8 +60,7 @@ const RecipientsPage: NextPageWithLayout = (props: any) => {
|
|||||||
color="primary"
|
color="primary"
|
||||||
icon={PaperAirplaneIcon}
|
icon={PaperAirplaneIcon}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
alert();
|
send(props.document);
|
||||||
// todo do stuff
|
|
||||||
}}
|
}}
|
||||||
disabled={(props?.document?.Recipient?.length || 0) === 0}
|
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;
|
export default RecipientsPage;
|
||||||
|
|||||||
@ -19,6 +19,7 @@ export const getDocument = async (
|
|||||||
},
|
},
|
||||||
include: {
|
include: {
|
||||||
Recipient: true,
|
Recipient: true,
|
||||||
|
User: { select: { name: true, email: true } },
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user