added backend

This commit is contained in:
nabijonovdavronbek619@gmail.com
2025-12-24 14:17:04 +05:00
parent de12e23af1
commit c5d3b02737
11 changed files with 149 additions and 179 deletions

View File

@@ -1,14 +0,0 @@
import axios from "axios";
export async function GET() {
try {
const res = await axios.get("https://api.serenmebel.uz/api/products/");
console.log("all products res: ", res?.data);
return Response.json(res.data);
} catch (error: any) {
console.log("all products error: ", error);
return Response.json({ error: error.message });
}
}

View File

@@ -1,61 +1,16 @@
interface features {
key_uz: string;
key_ru: string;
value_uz: string;
value_ru: string;
}
export interface Product {
id: string;
nameKey: string;
slug: string;
shortDescriptionKey: string;
longDescriptionKey?: string;
images: string[];
model3D?: string;
specs: { key: string; value: string }[];
}
// Sample products data
export const products: Product[] = [
{
id: "1",
nameKey: "Schotchik Nasos",
slug: "Yuqori sifatli schotchik nasos, benzin, dizel va kerosinni tashishda ishlatiladi.",
shortDescriptionKey: "Xavfsiz neft mahsulotlarini tashish uchun",
images: ["/product/product.jpg", "/images/pump-1-alt.jpg"],
specs: [
{ key: "Flow Rate", value: "100 L/min" },
{ key: "Pressure", value: "10 bar" },
{ key: "Power", value: "5.5 kW" },
{ key: "Temperature Range", value: "-10°C to 60°C" },
],
},
{
id: "2",
nameKey: "Agregat Nasos",
slug: "Katta volumli neft mahsulotlarini tashishda o'rnatilgan.",
shortDescriptionKey: "Kuchli va ishonchli aggregat nasos",
images: ["/product/product1.jpg", "/images/pump-2-alt.jpg"],
specs: [
{ key: "Flow Rate", value: "250 L/min" },
{ key: "Pressure", value: "15 bar" },
{ key: "Power", value: "11 kW" },
{ key: "Temperature Range", value: "-10°C to 70°C" },
],
},
{
id: "3",
nameKey: "СЦЛ 20/24",
slug:"Chuqurligi 20-24 metrda ishlaydigan professional nasos.",
shortDescriptionKey: "Professional kalibrli nasos",
images: ["/product/product2.jpg", "/images/pump-3-alt.jpg"],
specs: [
{ key: "Depth Rating", value: "20-24 m" },
{ key: "Flow Rate", value: "150 L/min" },
{ key: "Suction Lift", value: "7 m" },
{ key: "Power", value: "7.5 kW" },
],
},
];
export function getProductBySlug(slug: string): Product | undefined {
return products.find((p) => p.slug === slug);
}
export function getAllProducts(): Product[] {
return products;
id: number;
name_uz: string;
name_ru: string;
description_uz: string;
description_ru: string;
features:features[];
image:string;
}

View File

@@ -92,6 +92,7 @@ export const translations = {
},
more: "Ko'proq ko'rish",
details: "Batafsil",
features: "Texnik tavsiflar",
empty_data: {
description: "Mahsulot topilmadi!!!",
back: "Asosiy sahifaga qaytish",
@@ -195,6 +196,7 @@ export const translations = {
},
more: "Смотреть больше",
details: "Подробнее",
features: "Технические характеристики",
empty_data: {
description: "Товар не найден!!!",
back: "Вернуться на главную страницу",