From 72c8081e7c135ab1f600ed7e3d7a0bf03dabde34 Mon Sep 17 00:00:00 2001 From: Elias Schneider Date: Fri, 6 Jan 2023 09:21:46 +0100 Subject: [PATCH] fix: error message typo --- .../components/admin/configuration/AdminConfigTable.tsx | 7 ++++--- frontend/src/pages/upload.tsx | 9 ++------- frontend/src/utils/toast.util.tsx | 2 +- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/frontend/src/components/admin/configuration/AdminConfigTable.tsx b/frontend/src/components/admin/configuration/AdminConfigTable.tsx index 6913992..dc31500 100644 --- a/frontend/src/components/admin/configuration/AdminConfigTable.tsx +++ b/frontend/src/components/admin/configuration/AdminConfigTable.tsx @@ -115,9 +115,10 @@ const AdminConfigTable = () => { if (config.get("SETUP_FINISHED")) { configService .updateMany(updatedConfigVariables) - .then(() => - toast.success("Configurations updated successfully") - ) + .then(() => { + updatedConfigVariables = []; + toast.success("Configurations updated successfully"); + }) .catch(toast.axiosError); } else { configService diff --git a/frontend/src/pages/upload.tsx b/frontend/src/pages/upload.tsx index 4afaf1b..21a440c 100644 --- a/frontend/src/pages/upload.tsx +++ b/frontend/src/pages/upload.tsx @@ -1,6 +1,5 @@ import { Button, Group } from "@mantine/core"; import { useModals } from "@mantine/modals"; -import axios from "axios"; import { useRouter } from "next/router"; import pLimit from "p-limit"; import { useEffect, useState } from "react"; @@ -63,11 +62,7 @@ const Upload = () => { await Promise.all(uploadPromises); } catch (e) { - if (axios.isAxiosError(e)) { - toast.error(e.response?.data?.message ?? "An unkown error occured."); - } else { - toast.error("An unkown error occured."); - } + toast.axiosError(e); setisUploading(false); } }; @@ -93,7 +88,7 @@ const Upload = () => { setFiles([]); }) .catch(() => - toast.error("An error occured while finishing your share.") + toast.error("An error occurred while finishing your share.") ); } } diff --git a/frontend/src/utils/toast.util.tsx b/frontend/src/utils/toast.util.tsx index 069c3b3..4bb557d 100644 --- a/frontend/src/utils/toast.util.tsx +++ b/frontend/src/utils/toast.util.tsx @@ -11,7 +11,7 @@ const error = (message: string) => }); const axiosError = (axiosError: any) => - error(axiosError?.response?.data?.message ?? "An unknown error occured"); + error(axiosError?.response?.data?.message ?? "An unknown error occurred"); const success = (message: string) => showNotification({