fixed edit product

This commit is contained in:
2ManyProjects 2025-04-25 22:49:09 -05:00
parent bd0fcb4955
commit a67b4f881f
2 changed files with 3 additions and 3 deletions

View file

@ -90,7 +90,7 @@ const ProductEditPage = () => {
queryKey: ['product', id],
queryFn: async () => {
const response = await apiClient.get(`/products/${id}`);
return response.data;
return response.data[0];
},
enabled: !isNewProduct
});

View file

@ -40,9 +40,9 @@ const ProductDetailPage = () => {
const [selectedImage, setSelectedImage] = useState(0);
// Fetch product data
const { data: product, isLoading, error } = useProduct(id);
const { data: products, isLoading, error } = useProduct(id);
const addToCart = useAddToCart();
let product = products[0]
// Handle quantity changes
const increaseQuantity = () => {
if (product && quantity < product.stock_quantity) {