From 18cac0345b4768d48ccfafa967bfa57616b0a22e Mon Sep 17 00:00:00 2001 From: jude Date: Wed, 27 Mar 2024 17:19:19 +0000 Subject: [PATCH] Allow removing attachments Show HTTP errors --- reminder-dashboard/index.html | 1 - .../src/components/Reminder/Attachment.tsx | 32 ++++++++++++++++++- .../Reminder/ButtonRow/CreateButtonRow.tsx | 6 ++++ .../Reminder/ButtonRow/EditButtonRow.tsx | 6 ++++ 4 files changed, 43 insertions(+), 2 deletions(-) diff --git a/reminder-dashboard/index.html b/reminder-dashboard/index.html index 3a1302b..f3703ab 100644 --- a/reminder-dashboard/index.html +++ b/reminder-dashboard/index.html @@ -26,7 +26,6 @@ -
diff --git a/reminder-dashboard/src/components/Reminder/Attachment.tsx b/reminder-dashboard/src/components/Reminder/Attachment.tsx index 7e5cce8..a285c66 100644 --- a/reminder-dashboard/src/components/Reminder/Attachment.tsx +++ b/reminder-dashboard/src/components/Reminder/Attachment.tsx @@ -39,12 +39,42 @@ export const Attachment = () => { }} > - {attachment_name || "Add Attachment"} + + {attachment_name || "Add Attachment"} + + {attachment_name && ( + <> + + + )} ); }; diff --git a/reminder-dashboard/src/components/Reminder/ButtonRow/CreateButtonRow.tsx b/reminder-dashboard/src/components/Reminder/ButtonRow/CreateButtonRow.tsx index 2a19d0b..b12ca3b 100644 --- a/reminder-dashboard/src/components/Reminder/ButtonRow/CreateButtonRow.tsx +++ b/reminder-dashboard/src/components/Reminder/ButtonRow/CreateButtonRow.tsx @@ -18,6 +18,12 @@ export const CreateButtonRow = () => { const queryClient = useQueryClient(); const mutation = useMutation({ ...(guild ? postGuildReminder(guild) : postUserReminder()), + onError: (error) => { + flash({ + message: `An error occurred: ${error}`, + type: "error", + }); + }, onSuccess: (data) => { if (data.error) { flash({ diff --git a/reminder-dashboard/src/components/Reminder/ButtonRow/EditButtonRow.tsx b/reminder-dashboard/src/components/Reminder/ButtonRow/EditButtonRow.tsx index 5c4a281..7668d92 100644 --- a/reminder-dashboard/src/components/Reminder/ButtonRow/EditButtonRow.tsx +++ b/reminder-dashboard/src/components/Reminder/ButtonRow/EditButtonRow.tsx @@ -19,6 +19,12 @@ export const EditButtonRow = () => { const flash = useFlash(); const mutation = useMutation({ ...(guild ? patchGuildReminder(guild) : patchUserReminder()), + onError: (error) => { + flash({ + message: `An error occurred: ${error}`, + type: "error", + }); + }, onSuccess: (response) => { if (guild) { queryClient.invalidateQueries({