diff --git a/frontend/src/context/api/ApiProvider.tsx b/frontend/src/context/api/ApiProvider.tsx index a29949d..e2d9328 100644 --- a/frontend/src/context/api/ApiProvider.tsx +++ b/frontend/src/context/api/ApiProvider.tsx @@ -93,11 +93,11 @@ const ApiContext = React.createContext(null!); * @returns {ReactElement} The rendered child components wrapped in the ApiProvider.Provider. */ export function ApiProvider({ - baseUrl, - auth, - client, - children, - }: { + baseUrl, + auth, + client, + children, +}: { baseUrl: string; auth?: AuthContextType; client: QueryClient; diff --git a/frontend/src/controls/Avatars/UtilisateurAvatarImage.tsx b/frontend/src/controls/Avatars/UtilisateurAvatarImage.tsx index 60c0165..15558ad 100644 --- a/frontend/src/controls/Avatars/UtilisateurAvatarImage.tsx +++ b/frontend/src/controls/Avatars/UtilisateurAvatarImage.tsx @@ -106,9 +106,15 @@ export default function UtilisateurAvatarImage(props: { } return fetch(`${env.REACT_APP_API}${utilisateurData?.["@id"]}/photo`, fetchOptions) - .then((response) => response.blob()) + .then((response) => { + if (response.status === 200) { + return response.blob(); + } + return null; + }) .then((blob) => { - if (blob.type !== "application/ld+json") { + if (blob) { + // image renvoyée return window.URL.createObjectURL(blob); } else { return null; @@ -145,18 +151,16 @@ export default function UtilisateurAvatarImage(props: { if (props.as === "img") { if (photo.data) return ( - <> - {`Photo - + {`Photo ); }