diff --git a/GrossesMitaines/grosses-mitaines-ui/src/components/FeaturedList.js b/GrossesMitaines/grosses-mitaines-ui/src/components/FeaturedList.js index ef532d3..9cb0691 100644 --- a/GrossesMitaines/grosses-mitaines-ui/src/components/FeaturedList.js +++ b/GrossesMitaines/grosses-mitaines-ui/src/components/FeaturedList.js @@ -14,7 +14,7 @@ const FeaturedList = ({ products }) => {

{product.title}

-

{product.description}

+

{(product.description).substring(0,100)}...

Seulement

{product.promoPrice} $ CA

diff --git a/GrossesMitaines/grosses-mitaines-ui/src/pages/MorceauDetail.js b/GrossesMitaines/grosses-mitaines-ui/src/pages/MorceauDetail.js index 25cea8a..a439a80 100644 --- a/GrossesMitaines/grosses-mitaines-ui/src/pages/MorceauDetail.js +++ b/GrossesMitaines/grosses-mitaines-ui/src/pages/MorceauDetail.js @@ -8,31 +8,15 @@ const MorceauDetail = () => { const { id } = useParams(); const [item, setItem] = useState({}); - const [isLoading, setIsLoading] = useState(false); const [imageSrc, setImageSrc] = useState(null); const [itemQty, setItemQty] = useState(0); - - const updateQty = () => { - window.setTimeout(() => { - fetch(`https://localhost:7292/api/Product/Quantity?id=${id}`) - .then(async (response) => { - if (response.ok) { - const qty = await response.json(); - setItemQty(qty); - } - else { - console.log("Un erreur est survenu lors de l'appelle de: " - + `https://localhost:7292/api/Product/Quantity?id=${id}`); - } - updateQty(); - }) - }, 10000); + const isNoStock = () => { + return item.status == 1 || item.status == 2 || item.status == 5; } useEffect(() => { document.title = 'Morceaux'; - setIsLoading(true); async function fetchData() { const response = await fetch(`https://localhost:7292/api/Product?id=${id}`); const json = await response.json(); @@ -48,13 +32,8 @@ const MorceauDetail = () => { .then(blob => { const imageUrl = URL.createObjectURL(blob); setImageSrc(imageUrl); - }) + }); - setIsLoading(false); - }); - - - useEffect(() => { }, []); @@ -150,15 +129,15 @@ const MorceauDetail = () => {
- Qté. restante: {item.status == 1 || item.status == 2 || item.status == 5 ? "Aucun" : itemQty} + Qté. restante: {isNoStock() ? "Aucun" : itemQty}

{item.description}

-