From c9946b3d337d33398ad031bf63c67864caaaa1d9 Mon Sep 17 00:00:00 2001 From: Ahmed Al-Taiar Date: Wed, 22 Nov 2023 11:47:38 -0500 Subject: [PATCH] Forgot to check for the stock in the part detils page --- web/src/components/PartDetailsCell/PartDetailsCell.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/web/src/components/PartDetailsCell/PartDetailsCell.tsx b/web/src/components/PartDetailsCell/PartDetailsCell.tsx index 35a4b7b..60e8724 100644 --- a/web/src/components/PartDetailsCell/PartDetailsCell.tsx +++ b/web/src/components/PartDetailsCell/PartDetailsCell.tsx @@ -55,7 +55,7 @@ const image = (url: string, size: number) => { } export const Success = ({ part }: CellSuccessProps) => { - const [toTake, setToTake] = useState(1) + const [toTake, setToTake] = useState(part.availableStock > 0 ? 1 : 0) return (
@@ -81,7 +81,9 @@ export const Success = ({ part }: CellSuccessProps) => {