diff --git a/src/frontend/src/hooks/organizations.hooks.ts b/src/frontend/src/hooks/organizations.hooks.ts index 3d425b4a8e..162476bcdf 100644 --- a/src/frontend/src/hooks/organizations.hooks.ts +++ b/src/frontend/src/hooks/organizations.hooks.ts @@ -11,6 +11,7 @@ import { setOrganizationFeaturedProjects } from '../apis/organizations.api'; import { downloadGoogleImage } from '../apis/finance.api'; +import { getDefaultImageData } from '../utils/image.utils'; interface OrganizationProvider { organizationId: string; @@ -98,11 +99,13 @@ export const useSetOrganizationLogo = () => { }; export const useOrganizationLogo = () => { - return useQuery<{ url: string; blob: Blob }, Error>(['organizations', 'logo'], async () => { - const { data: fileId } = await getOrganizationLogo(); - - const imageBlob = await downloadGoogleImage(fileId); - - return { url: URL.createObjectURL(imageBlob), blob: imageBlob }; + return useQuery(['organizations', 'logo'], async () => { + try { + const { data: fileId } = await getOrganizationLogo(); + return await downloadGoogleImage(fileId); + } catch { + // return default logo if fileId was not found + return getDefaultImageData(); + } }); }; diff --git a/src/frontend/src/pages/AdminToolsPage/EditGuestView/EditLogo.tsx b/src/frontend/src/pages/AdminToolsPage/EditGuestView/EditLogo.tsx index 8f5c6294b4..6fd56bbe66 100644 --- a/src/frontend/src/pages/AdminToolsPage/EditGuestView/EditLogo.tsx +++ b/src/frontend/src/pages/AdminToolsPage/EditGuestView/EditLogo.tsx @@ -60,12 +60,12 @@ const EditLogo = () => { ) : ( <> - + = ({ imageUrl = './default-logo.png' }) => { +const LogoDisplay: React.FC = ({ imageUrl }) => { const theme = useTheme(); return ( { + const { data } = await axios.get('/default-logo.png', { + responseType: 'blob' + }); + return data; +};