products page error fixed
This commit is contained in:
parent
8d79ce8cb0
commit
dec255c54a
@ -13,9 +13,8 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"author": "The CoreUI Team (https://github.com/orgs/coreui/people)",
|
"author": "The CoreUI Team (https://github.com/orgs/coreui/people)",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "react-scripts start",
|
"dev": "react-scripts --openssl-legacy-provider start",
|
||||||
"build": "react-scripts build",
|
"build": "react-scripts --openssl-legacy-provider build",
|
||||||
"build:n17": "react-scripts --openssl-legacy-provider build",
|
|
||||||
"changelog": "auto-changelog --starting-version 4.1.0 --commit-limit false --hide-credit",
|
"changelog": "auto-changelog --starting-version 4.1.0 --commit-limit false --hide-credit",
|
||||||
"eject": "react-scripts eject",
|
"eject": "react-scripts eject",
|
||||||
"lint": "eslint \"src/**/*.js\"",
|
"lint": "eslint \"src/**/*.js\"",
|
||||||
|
@ -13,7 +13,8 @@ import { cibGmail } from "@coreui/icons";
|
|||||||
import { createRoot } from "react-dom/client";
|
import { createRoot } from "react-dom/client";
|
||||||
|
|
||||||
const setupAxios = () => {
|
const setupAxios = () => {
|
||||||
axios.defaults.baseURL = "http://localhost:5000";
|
// axios.defaults.baseURL = "http://localhost:5000";
|
||||||
|
axios.defaults.baseURL = "https://api.smellika.com";
|
||||||
|
|
||||||
axios.defaults.headers = {
|
axios.defaults.headers = {
|
||||||
"Cache-Control": "no-cache,no-store",
|
"Cache-Control": "no-cache,no-store",
|
||||||
|
@ -44,7 +44,6 @@ const Products = () => {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log(res.data?.product);
|
|
||||||
setProductsData(res.data?.product);
|
setProductsData(res.data?.product);
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
})
|
})
|
||||||
@ -135,7 +134,7 @@ const Products = () => {
|
|||||||
const result = fuse.search(query);
|
const result = fuse.search(query);
|
||||||
|
|
||||||
const searchedResult = result.map((result) => result.item);
|
const searchedResult = result.map((result) => result.item);
|
||||||
|
console.log(searchedResult);
|
||||||
setQueryData(searchedResult);
|
setQueryData(searchedResult);
|
||||||
};
|
};
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -148,8 +147,9 @@ const Products = () => {
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (filterCategory !== "") {
|
if (filterCategory !== "") {
|
||||||
const filteredProducts = productsData.filter(
|
const filteredProducts = productsData.filter(
|
||||||
(product) => product.category === filterCategory
|
(product) => product.category?.categoryName === filterCategory
|
||||||
);
|
);
|
||||||
|
|
||||||
setFilterData(filteredProducts);
|
setFilterData(filteredProducts);
|
||||||
} else {
|
} else {
|
||||||
// If no category is selected, show all products
|
// If no category is selected, show all products
|
||||||
@ -480,7 +480,7 @@ const Products = () => {
|
|||||||
<td className="text-start">{product.name}</td>
|
<td className="text-start">{product.name}</td>
|
||||||
<td className="text-start">
|
<td className="text-start">
|
||||||
{product.category !== ""
|
{product.category !== ""
|
||||||
? product.category
|
? product.category?.categoryName
|
||||||
: "Category Not selected "}
|
: "Category Not selected "}
|
||||||
</td>
|
</td>
|
||||||
<th className="text-start">₹{product.price}</th>
|
<th className="text-start">₹{product.price}</th>
|
||||||
@ -582,7 +582,7 @@ const Products = () => {
|
|||||||
</th>
|
</th>
|
||||||
<td className="text-start">{product.name}</td>
|
<td className="text-start">{product.name}</td>
|
||||||
<td className="text-start">
|
<td className="text-start">
|
||||||
{product.category}
|
{product.category?.categoryName}
|
||||||
</td>
|
</td>
|
||||||
<th className="text-start">₹{product.price}</th>
|
<th className="text-start">₹{product.price}</th>
|
||||||
<td className="text-start">
|
<td className="text-start">
|
||||||
|
Loading…
Reference in New Issue
Block a user