mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 16:23:06 +10:00
♻️ 🧹 upsert reciient, deleteRecipient, send
This commit is contained in:
31
packages/lib/api/deleteRecipient.ts
Normal file
31
packages/lib/api/deleteRecipient.ts
Normal 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",
|
||||
},
|
||||
}
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user