дописал логику подгрузки характеристик продукта
This commit is contained in:
1 parent
5d9191ac24
commit
a18a706366
1 file changed
+6
-4
@@ -3,8 +3,7 @@ import { useParams, useNavigate } from "react-router-dom";
|
|||||||
import { useAppDispatch, useAppSelector } from "../../app/hooks";
|
import { useAppDispatch, useAppSelector } from "../../app/hooks";
|
||||||
import { fetchProductById } from "../../features/catalog/productsSlice";
|
import { fetchProductById } from "../../features/catalog/productsSlice";
|
||||||
import styles from "./ProductPage.module.css";
|
import styles from "./ProductPage.module.css";
|
||||||
//import type { Product } from "../../types/product";
|
import type { CategoryAtributes, CategoryAtrVals } from "../../types/categories";
|
||||||
import type { CategoryAtributes } from "../../types/categories";
|
|
||||||
|
|
||||||
const ItemPage = () => {
|
const ItemPage = () => {
|
||||||
const { id } = useParams();
|
const { id } = useParams();
|
||||||
@@ -12,7 +11,6 @@ const ItemPage = () => {
|
|||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { items, loading } = useAppSelector((state) => state.products);
|
const { items, loading } = useAppSelector((state) => state.products);
|
||||||
const { items: cats, selectedCategoryId } = useAppSelector(s => s.categories);
|
const { items: cats, selectedCategoryId } = useAppSelector(s => s.categories);
|
||||||
//const filters = useAppSelector(s => s.products.filtersApplied);
|
|
||||||
|
|
||||||
const [activeTab, setActiveTab] = useState<"desc" | "chars">("desc");
|
const [activeTab, setActiveTab] = useState<"desc" | "chars">("desc");
|
||||||
|
|
||||||
@@ -83,7 +81,11 @@ const ItemPage = () => {
|
|||||||
{category.atributes?.map((attr: CategoryAtributes) => (
|
{category.atributes?.map((attr: CategoryAtributes) => (
|
||||||
<div key={attr.id} className={styles.attrRow}>
|
<div key={attr.id} className={styles.attrRow}>
|
||||||
<span>{attr.name}</span>
|
<span>{attr.name}</span>
|
||||||
<span>{}</span>
|
{attr.vals?.map((val: CategoryAtrVals) => (
|
||||||
|
<div key={val.id}>
|
||||||
|
<span>{val.val}</span>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in new issue
Block a user