📑 todods

This commit is contained in:
Timur Ercan
2023-02-28 19:56:01 +01:00
parent 9741959d09
commit f79e7471e0
5 changed files with 8 additions and 0 deletions

View File

@ -50,6 +50,7 @@ const DocumentsPage: NextPageWithLayout = (props: any) => {
const getDocuments = async () => {
if (!documents.length) setLoading(true);
// todo encapsulate
fetch("/api/documents", {
headers: {
"Content-Type": "application/json",
@ -354,6 +355,7 @@ const DocumentsPage: NextPageWithLayout = (props: any) => {
const removedItem: any =
documentsWithoutIndex.splice(index, 1);
setDocuments(documentsWithoutIndex);
// todo encapsulate
fetch(`/api/documents/${document.id}`, {
method: "DELETE",
})

View File

@ -383,6 +383,7 @@ const RecipientsPage: NextPageWithLayout = (props: any) => {
);
};
// todo encapsulate
async function deleteRecipient(recipient: any) {
if (!recipient.id) {
return;
@ -413,6 +414,7 @@ async function deleteRecipient(recipient: any) {
);
}
// todo encapsulate
async function upsertRecipient(recipient: any): Promise<any> {
try {
const created = await toast.promise(
@ -466,6 +468,7 @@ export async function getServerSideProps(context: any) {
};
}
// todo encapsulate
async function send(document: any, resendTo: number[] = []) {
if (!document || !document.id) return;
try {