From 16e0321db0b16e3d17750aa487d3c5a37c1e3a03 Mon Sep 17 00:00:00 2001
From: Victor Turgeon <76506447+Medenos@users.noreply.github.com>
Date: Tue, 1 Nov 2022 18:59:52 -0400
Subject: [PATCH] Loading cat for images.
---
.../src/components/FeaturedImage.js | 33 ++++++++++++-------
.../src/components/Item.js | 3 +-
.../src/pages/MorceauDetail.js | 19 +++++------
.../grosses-mitaines-ui/src/pages/Morceaux.js | 2 +-
4 files changed, 33 insertions(+), 24 deletions(-)
diff --git a/GrossesMitaines/grosses-mitaines-ui/src/components/FeaturedImage.js b/GrossesMitaines/grosses-mitaines-ui/src/components/FeaturedImage.js
index f259820..f500a23 100644
--- a/GrossesMitaines/grosses-mitaines-ui/src/components/FeaturedImage.js
+++ b/GrossesMitaines/grosses-mitaines-ui/src/components/FeaturedImage.js
@@ -2,24 +2,33 @@ import { useState, useEffect } from "react";
const FeaturedImage = ({ productId }) => {
- const [imageSrc, setImageSrc] = useState("/images/default_thumbnail.jpg");
+ const [imageSrc, setImageSrc] = useState(null);
useEffect(() => {
fetch(`https://localhost:7292/api/Image?id=${productId}`)
- .then(response => response.blob())
- .then(blob => {
- const imageUrl = URL.createObjectURL(blob);
- setImageSrc(imageUrl);
- })
- },[]);
+ .then(response => response.blob())
+ .then(blob => {
+ const imageUrl = URL.createObjectURL(blob);
+ setImageSrc(imageUrl);
+ })
+ }, []);
return (
-
+ <>
+ {!imageSrc ?
+
{item.description}