diff --git a/app/category-page/[categoryId]/products/[productId]/page.tsx b/app/category-page/[categoryId]/products/[productId]/page.tsx index 282a3c9f..ed89dafb 100644 --- a/app/category-page/[categoryId]/products/[productId]/page.tsx +++ b/app/category-page/[categoryId]/products/[productId]/page.tsx @@ -25,7 +25,7 @@ const ProductDetail = ({ params: { categoryId: string; productId: string }; }) => { const [product, setProduct] = useState(null); // State to hold the fetched product details - const [isLoading, setIsLoading] = useState(false); // State to hold loading status + const [isLoading, setIsLoading] = useState(true); // State to hold loading status const [error] = useState(null); // State to hold any error that occurs during fetching const { categoryId, productId } = params; @@ -35,7 +35,7 @@ const ProductDetail = ({ const fetchUrl = `http://localhost:3000/api/products/find/${productId}`; const fetchProductDetails = async () => { - setIsLoading(true); + setIsLoading(false); try { const response = await fetch(fetchUrl, { method: "GET",