Skip to content

Commit

Permalink
update loading status (#240)
Browse files Browse the repository at this point in the history
  • Loading branch information
tinpham5614 authored Feb 25, 2024
1 parent a47bcec commit 2985740
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/category-page/[categoryId]/products/[productId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const ProductDetail = ({
params: { categoryId: string; productId: string };
}) => {
const [product, setProduct] = useState<Product | null>(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;
Expand All @@ -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",
Expand Down

0 comments on commit 2985740

Please sign in to comment.