ceo optimization

This commit is contained in:
nabijonovdavronbek619@gmail.com
2026-01-09 17:38:01 +05:00
parent a700fdddc6
commit c2c39d44a0
11 changed files with 117 additions and 50 deletions

View File

@@ -5,6 +5,8 @@ import { motion } from "framer-motion";
import { ProductCard } from "../productSection/ProductCard";
import axios from "axios";
import Loading from "../loading";
import { generateSlug } from "@/lib/slug";
import { getAllProducts } from "@/lib/api";
const itemVariants = {
hidden: { opacity: 0, y: 20 },
@@ -18,14 +20,14 @@ export default function Products() {
useEffect(() => {
async function getData() {
setLoading(true);
await axios
.get("https://admin.promtechno.uz/api/products/")
.then((res) => {
console.log("all data: ", res?.data);
const allData = res?.data || [];
setAllProducts(allData);
setLoading(false);
});
const products = await getAllProducts();
setAllProducts(
products.map((product: any) => ({
...product,
slug: generateSlug(product.name_uz),
}))
);
setLoading(false);
}
getData();
}, []);