♻️ 🧹 upsert reciient, deleteRecipient, send

This commit is contained in:
Timur Ercan
2023-03-01 15:41:43 +01:00
parent 891f032468
commit 10b81bc757
8 changed files with 119 additions and 106 deletions

View File

@ -0,0 +1,31 @@
import toast from "react-hot-toast";
export const deleteRecipient = (recipient: any) => {
if (!recipient.id) {
return;
}
return toast.promise(
fetch(
"/api/documents/" + recipient.documentId + "/recipients/" + recipient.id,
{
method: "DELETE",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(recipient),
}
),
{
loading: "Deleting...",
success: "Deleted.",
error: "Could not delete :/",
},
{
id: "delete",
style: {
minWidth: "200px",
},
}
);
};