From f79e7471e061606fa301d3bc0e0c33ca7312a435 Mon Sep 17 00:00:00 2001 From: Timur Ercan Date: Tue, 28 Feb 2023 19:56:01 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=91=20todods?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web/components/navigation.tsx | 1 + apps/web/components/settings.tsx | 1 + apps/web/components/signup.tsx | 1 + apps/web/pages/documents.tsx | 2 ++ apps/web/pages/documents/[id]/recipients.tsx | 3 +++ 5 files changed, 8 insertions(+) diff --git a/apps/web/components/navigation.tsx b/apps/web/components/navigation.tsx index e77ce934e..be25d2c24 100644 --- a/apps/web/components/navigation.tsx +++ b/apps/web/components/navigation.tsx @@ -86,6 +86,7 @@ export default function TopNavigation() { }); useEffect(() => { + // todo encapsulate fetch("/api/users/me").then((res) => { res.json().then((j) => { setUser(j); diff --git a/apps/web/components/settings.tsx b/apps/web/components/settings.tsx index feb3c8c79..bb894389a 100644 --- a/apps/web/components/settings.tsx +++ b/apps/web/components/settings.tsx @@ -34,6 +34,7 @@ export default function Setttings() { }); useEffect(() => { + // todo encapsulate fetch("/api/users/me").then((res) => { res.json().then((j) => { setUser(j); diff --git a/apps/web/components/signup.tsx b/apps/web/components/signup.tsx index 808980e14..d6e389c92 100644 --- a/apps/web/components/signup.tsx +++ b/apps/web/components/signup.tsx @@ -30,6 +30,7 @@ export default function Signup(props: { source: string }) { }; const signUp: SubmitHandler = async (data) => { + // todo encapsulate const res = await toast .promise( fetch("/api/auth/signup", { diff --git a/apps/web/pages/documents.tsx b/apps/web/pages/documents.tsx index b1282a7f6..b2bd7570c 100644 --- a/apps/web/pages/documents.tsx +++ b/apps/web/pages/documents.tsx @@ -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", }) diff --git a/apps/web/pages/documents/[id]/recipients.tsx b/apps/web/pages/documents/[id]/recipients.tsx index 25376a9dd..42447d809 100644 --- a/apps/web/pages/documents/[id]/recipients.tsx +++ b/apps/web/pages/documents/[id]/recipients.tsx @@ -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 { 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 {