From 3e3d8285d5ec3362c14fb3eefb24090db2a4ca49 Mon Sep 17 00:00:00 2001 From: Marline Vauchair <marline.vauchair@etu.unistra.fr> Date: Fri, 17 Dec 2021 14:42:44 +0100 Subject: [PATCH] :bug: fix update stock --- src/pages/stock.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/stock.tsx b/src/pages/stock.tsx index 954e68f..78a3b5b 100644 --- a/src/pages/stock.tsx +++ b/src/pages/stock.tsx @@ -8,7 +8,7 @@ const Stock = () => { let [search, setSearch] = useState(""); let [productsList, setProductsList] = useState<Product[]>([]); let [rawProductList, setRawProductList] = useState<Product[]>([]); - let oldQuantity = 0; + let [oldQuantity, setOldQuantity] = useState((0)); useEffect(() => { // Filter products by name with the search term @@ -48,7 +48,7 @@ const Stock = () => { console.log("error update stock BACK"); }); }else{ - oldQuantity = product.stock; + setOldQuantity(product.stock); } }; -- GitLab