recipients ui and api basics

This commit is contained in:
Timur Ercan
2023-02-03 18:39:17 +01:00
parent e9db5acc85
commit b854600fb3
5 changed files with 59 additions and 2 deletions

View File

@ -180,6 +180,29 @@ const RecipientsPage: NextPageWithLayout = (props: any) => {
);
};
async delete(recipient:any){
toast.promise(
fetch("/api/documents/" + recipient.documentId + "/recipients", {
method: "DELETE",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(recipient),
}),
{
loading: "Deleting...",
success: "Deleted.",
error: "Could not delete :/",
},
{
id: "deleting",
style: {
minWidth: "200px",
},
}
);
}
async function upsertRecipient(recipient: any) {
toast.promise(
fetch("/api/documents/" + recipient.documentId + "/recipients", {