From 06df95061e749f6e1d9f9739e15788c6221d8b50 Mon Sep 17 00:00:00 2001 From: caiodasilva2005 Date: Fri, 20 Dec 2024 12:03:01 -0500 Subject: [PATCH] #3060-fixed issues --- .../AdminToolsPage/EditGuestView/EditLogo.tsx | 14 +++++++++++--- .../AdminToolsPage/EditGuestView/EditLogoForm.tsx | 14 +------------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/frontend/src/pages/AdminToolsPage/EditGuestView/EditLogo.tsx b/src/frontend/src/pages/AdminToolsPage/EditGuestView/EditLogo.tsx index 13ef97a3f6..d4c10f0e76 100644 --- a/src/frontend/src/pages/AdminToolsPage/EditGuestView/EditLogo.tsx +++ b/src/frontend/src/pages/AdminToolsPage/EditGuestView/EditLogo.tsx @@ -6,16 +6,24 @@ import { useToast } from '../../../hooks/toasts.hooks'; import { Box, Card, Typography, useTheme } from '@mui/material'; import LogoDisplay from '../../HomePage/components/LogoDisplay'; import { NERButton } from '../../../components/NERButton'; +import ErrorPage from '../../ErrorPage'; const EditLogo = () => { - const { data: organization, isLoading: organizationIsLoading } = useCurrentOrganization(); - const { data: imageData, isLoading: imageDataIsLoading } = useOrganizationLogo(); + const { + data: organization, + isLoading: organizationIsLoading, + isError: organizationIsError, + error: organizationError + } = useCurrentOrganization(); + const { data: imageData, isLoading: imageDataIsLoading, isError: imageIsError, error: imageError } = useOrganizationLogo(); const { mutateAsync, isLoading } = useSetOrganizationLogo(); const toast = useToast(); const [isEditMode, setIsEditMode] = useState(false); const theme = useTheme(); if (isLoading || !mutateAsync || organizationIsLoading || !organization || imageDataIsLoading) return ; + if (organizationIsError) return ; + if (imageIsError) return ; const handleClose = () => { setIsEditMode(false); @@ -23,8 +31,8 @@ const EditLogo = () => { const onSubmit = async (logoInput: EditLogoInput) => { try { - console.log(logoInput); if (!logoInput.logoImage) { + toast.error('No logo image submitted.'); handleClose(); return; } diff --git a/src/frontend/src/pages/AdminToolsPage/EditGuestView/EditLogoForm.tsx b/src/frontend/src/pages/AdminToolsPage/EditGuestView/EditLogoForm.tsx index 3ebb20cf53..72be9d618e 100644 --- a/src/frontend/src/pages/AdminToolsPage/EditGuestView/EditLogoForm.tsx +++ b/src/frontend/src/pages/AdminToolsPage/EditGuestView/EditLogoForm.tsx @@ -23,13 +23,6 @@ const EditLogoForm: React.FC = ({ onSubmit, orgLogo, onHide } } }); - const onSubmitWrapper = async (data: EditLogoInput) => { - if (!!data.logoImage) { - await onSubmit(data); - } - reset(); - }; - const onHideWrapper = () => { onHide(); reset(); @@ -106,12 +99,7 @@ const EditLogoForm: React.FC = ({ onSubmit, orgLogo, onHide } Cancel - + Save