mirror of
https://github.com/documenso/documenso.git
synced 2025-11-15 17:21:41 +10:00
disable send if nothing to send
This commit is contained in:
@ -67,10 +67,9 @@ const RecipientsPage: NextPageWithLayout = (props: any) => {
|
|||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
disabled={
|
disabled={
|
||||||
(props?.document?.Recipient?.length || 0) === 0 ||
|
(signers.length || 0) === 0 ||
|
||||||
!props?.document?.Recipient?.some(
|
!signers.some((r: any) => r.sendStatus === "NOT_SENT") ||
|
||||||
(r: any) => r.sendStatus === "NOT_SENT"
|
loading
|
||||||
)
|
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
Send
|
Send
|
||||||
@ -346,15 +345,24 @@ async function send(document: any) {
|
|||||||
// todo toast
|
// todo toast
|
||||||
// loading
|
// loading
|
||||||
if (!document || !document.id) return;
|
if (!document || !document.id) return;
|
||||||
return await fetch(`/api/documents/${document.id}/send`, {
|
return toast
|
||||||
body: "",
|
.promise(
|
||||||
headers: {
|
fetch(`/api/documents/${document.id}/send`, {
|
||||||
"Content-Type": "application/json",
|
body: "",
|
||||||
},
|
headers: {
|
||||||
method: "POST",
|
"Content-Type": "application/json",
|
||||||
}).finally(() => {
|
},
|
||||||
location.reload();
|
method: "POST",
|
||||||
});
|
}),
|
||||||
|
{
|
||||||
|
loading: "Sending...",
|
||||||
|
success: `Sent!`,
|
||||||
|
error: "Changes could not send :/",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.finally(() => {
|
||||||
|
location.reload();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export default RecipientsPage;
|
export default RecipientsPage;
|
||||||
|
|||||||
Reference in New Issue
Block a user