slide
@@ -4,26 +4,25 @@ import { EmptyState } from "@/components/emptyState";
|
||||
import Text from "@/components/lib_components/text";
|
||||
import Title from "@/components/lib_components/title";
|
||||
import { LoadingSkeleton } from "@/components/loadingProduct";
|
||||
import { useCarType } from "@/store/carType";
|
||||
import { useSubCategory } from "@/store/subCategory";
|
||||
import { usePathname } from "next/navigation";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
const baseUrl = "https://api.spes-texnika.uz/api/v1/subcategory/?category=";
|
||||
|
||||
export default function CartType() {
|
||||
const initialCar = useCarType((state) => state.initialCar);
|
||||
const initialSubCategory = useSubCategory(
|
||||
(state) => state.initialSubCategory,
|
||||
);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const pathname = usePathname();
|
||||
const lang = pathname.split("/")[1];
|
||||
const [cars, setCars] = useState<any[]>([]);
|
||||
|
||||
console.log("car type id: ", initialCar.id);
|
||||
console.log("request URL: ", `${baseUrl}${initialCar.id}`);
|
||||
|
||||
useEffect(() => {
|
||||
// Agar ID bo'lmasa, fetchni ishga tushirma for gitea
|
||||
if (!initialCar.id) {
|
||||
if (!initialSubCategory.id) {
|
||||
setLoading(false);
|
||||
return;
|
||||
}
|
||||
@@ -33,7 +32,7 @@ export default function CartType() {
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
|
||||
const response = await fetch(`${baseUrl}${initialCar.id}`, {
|
||||
const response = await fetch(`${baseUrl}${initialSubCategory.id}`, {
|
||||
headers: {
|
||||
"Accept-Language": lang,
|
||||
},
|
||||
@@ -44,8 +43,7 @@ export default function CartType() {
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
console.log("backend full response: ", result);
|
||||
console.log("backend Data: ", result?.data);
|
||||
console.log("inner car: ", result)
|
||||
|
||||
// Data array ekanligini tekshirish
|
||||
if (result?.data) {
|
||||
@@ -88,7 +86,6 @@ export default function CartType() {
|
||||
{loading ? (
|
||||
<LoadingSkeleton />
|
||||
) : cars.length > 0 ? (
|
||||
// MUHIM: Array ustidan map qilish kerak!
|
||||
cars.map((car, index) => (
|
||||
<InnerProductcard key={car.id || index} data={car} />
|
||||
))
|
||||
|
||||
|
Before Width: | Height: | Size: 46 KiB |
BIN
assets/assenizator5.png
Normal file
|
After Width: | Height: | Size: 243 KiB |
|
Before Width: | Height: | Size: 42 KiB |
BIN
assets/cranes/kran130.png
Normal file
|
After Width: | Height: | Size: 161 KiB |
|
Before Width: | Height: | Size: 186 KiB |
BIN
assets/cranes/kran30.png
Normal file
|
After Width: | Height: | Size: 209 KiB |
|
Before Width: | Height: | Size: 231 KiB |
BIN
assets/cranes/kran50.png
Normal file
|
After Width: | Height: | Size: 204 KiB |
|
Before Width: | Height: | Size: 242 KiB |
BIN
assets/cranes/kran75.png
Normal file
|
After Width: | Height: | Size: 329 KiB |
|
Before Width: | Height: | Size: 107 KiB |
BIN
assets/cranes/manipulyator7.png
Normal file
|
After Width: | Height: | Size: 213 KiB |
|
Before Width: | Height: | Size: 625 KiB After Width: | Height: | Size: 368 KiB |
|
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 190 KiB |
|
Before Width: | Height: | Size: 911 KiB After Width: | Height: | Size: 280 KiB |
|
Before Width: | Height: | Size: 1.8 MiB After Width: | Height: | Size: 324 KiB |
|
Before Width: | Height: | Size: 1022 KiB After Width: | Height: | Size: 277 KiB |
|
Before Width: | Height: | Size: 1.3 MiB After Width: | Height: | Size: 202 KiB |
BIN
assets/details/cranes/2-3.png
Normal file
|
After Width: | Height: | Size: 242 KiB |
|
Before Width: | Height: | Size: 207 KiB |
BIN
assets/details/cranes/2-4.png
Normal file
|
After Width: | Height: | Size: 359 KiB |
|
Before Width: | Height: | Size: 164 KiB |
|
Before Width: | Height: | Size: 708 KiB After Width: | Height: | Size: 121 KiB |
|
Before Width: | Height: | Size: 966 KiB After Width: | Height: | Size: 264 KiB |
|
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 210 KiB |
|
Before Width: | Height: | Size: 114 KiB |
BIN
assets/details/cranes/4-5.png
Normal file
|
After Width: | Height: | Size: 223 KiB |
|
Before Width: | Height: | Size: 201 KiB |
BIN
assets/details/cranes/4-6.png
Normal file
|
After Width: | Height: | Size: 227 KiB |
|
Before Width: | Height: | Size: 1.0 MiB After Width: | Height: | Size: 164 KiB |
|
Before Width: | Height: | Size: 62 KiB |
BIN
assets/details/cranes/5-2.png
Normal file
|
After Width: | Height: | Size: 342 KiB |
|
Before Width: | Height: | Size: 106 KiB |
BIN
assets/details/cranes/all_cranes.png
Normal file
|
After Width: | Height: | Size: 154 KiB |
|
Before Width: | Height: | Size: 33 KiB |
BIN
assets/details/cranes/avtolift28.png
Normal file
|
After Width: | Height: | Size: 146 KiB |
|
Before Width: | Height: | Size: 70 KiB |
BIN
assets/details/cranes/avtolift53.png
Normal file
|
After Width: | Height: | Size: 201 KiB |
|
Before Width: | Height: | Size: 31 KiB |
BIN
assets/details/cranes/avtolift63.png
Normal file
|
After Width: | Height: | Size: 180 KiB |
|
Before Width: | Height: | Size: 28 KiB |
BIN
assets/details/cranes/avtovishka28.png
Normal file
|
After Width: | Height: | Size: 116 KiB |
|
Before Width: | Height: | Size: 41 KiB |
BIN
assets/details/cranes/avtovishka36.png
Normal file
|
After Width: | Height: | Size: 94 KiB |
|
Before Width: | Height: | Size: 94 KiB |
BIN
assets/details/cranes/avtovishka45.png
Normal file
|
After Width: | Height: | Size: 242 KiB |
|
Before Width: | Height: | Size: 148 KiB |
BIN
assets/details/cranes/avtovishka60.png
Normal file
|
After Width: | Height: | Size: 251 KiB |
|
Before Width: | Height: | Size: 26 KiB |
BIN
assets/details/cranes/avtovishka75.png
Normal file
|
After Width: | Height: | Size: 129 KiB |
|
Before Width: | Height: | Size: 36 KiB |
BIN
assets/details/cranes/avtovishka_card_image.png
Normal file
|
After Width: | Height: | Size: 246 KiB |
|
Before Width: | Height: | Size: 1.7 MiB After Width: | Height: | Size: 258 KiB |
|
Before Width: | Height: | Size: 2.0 MiB After Width: | Height: | Size: 165 KiB |
|
Before Width: | Height: | Size: 1.9 MiB After Width: | Height: | Size: 236 KiB |
|
Before Width: | Height: | Size: 1.3 MiB After Width: | Height: | Size: 231 KiB |
|
Before Width: | Height: | Size: 1.3 MiB After Width: | Height: | Size: 203 KiB |
|
Before Width: | Height: | Size: 2.3 MiB After Width: | Height: | Size: 149 KiB |
|
Before Width: | Height: | Size: 733 KiB After Width: | Height: | Size: 217 KiB |
|
Before Width: | Height: | Size: 1.7 MiB After Width: | Height: | Size: 234 KiB |
|
Before Width: | Height: | Size: 141 KiB |
BIN
assets/details/excavators/excavator.png
Normal file
|
After Width: | Height: | Size: 233 KiB |
|
Before Width: | Height: | Size: 96 KiB |
BIN
assets/details/excavators/excavator_mini1.png
Normal file
|
After Width: | Height: | Size: 222 KiB |
|
Before Width: | Height: | Size: 147 KiB |
BIN
assets/details/excavators/excavator_mini2.png
Normal file
|
After Width: | Height: | Size: 346 KiB |
|
Before Width: | Height: | Size: 139 KiB |
BIN
assets/details/excavators/gusinichnik_card_image.png
Normal file
|
After Width: | Height: | Size: 223 KiB |
|
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 276 KiB |
|
Before Width: | Height: | Size: 701 KiB After Width: | Height: | Size: 178 KiB |
|
Before Width: | Height: | Size: 43 KiB |
BIN
assets/details/loaders/1-3.png
Normal file
|
After Width: | Height: | Size: 235 KiB |
|
Before Width: | Height: | Size: 2.1 MiB After Width: | Height: | Size: 253 KiB |
BIN
assets/details/loaders/1-5.png
Normal file
|
After Width: | Height: | Size: 263 KiB |
|
Before Width: | Height: | Size: 69 KiB |
BIN
assets/details/loaders/1-6.png
Normal file
|
After Width: | Height: | Size: 163 KiB |
|
Before Width: | Height: | Size: 103 KiB |
BIN
assets/details/loaders/1-7.png
Normal file
|
After Width: | Height: | Size: 197 KiB |
|
Before Width: | Height: | Size: 97 KiB |
|
Before Width: | Height: | Size: 638 KiB After Width: | Height: | Size: 210 KiB |
|
Before Width: | Height: | Size: 92 KiB |
BIN
assets/details/loaders/2-5.png
Normal file
|
After Width: | Height: | Size: 199 KiB |
|
Before Width: | Height: | Size: 118 KiB |
BIN
assets/details/loaders/3-5.png
Normal file
|
After Width: | Height: | Size: 223 KiB |
|
Before Width: | Height: | Size: 59 KiB |
BIN
assets/details/loaders/3-6.png
Normal file
|
After Width: | Height: | Size: 125 KiB |
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 178 KiB |
|
Before Width: | Height: | Size: 1.8 MiB |
BIN
assets/details/loaders/3-8.png
Normal file
|
After Width: | Height: | Size: 128 KiB |
|
Before Width: | Height: | Size: 156 KiB |
BIN
assets/details/loaders/avtogreyder.png
Normal file
|
After Width: | Height: | Size: 285 KiB |
|
Before Width: | Height: | Size: 176 KiB |
BIN
assets/details/loaders/old_yuklagich_card_image.png
Normal file
|
After Width: | Height: | Size: 282 KiB |
|
Before Width: | Height: | Size: 56 KiB |
BIN
assets/details/loaders/teleskopik_bobkat.png
Normal file
|
After Width: | Height: | Size: 179 KiB |
|
Before Width: | Height: | Size: 46 KiB |
BIN
assets/details/loaders/teleskopik_jcb.png
Normal file
|
After Width: | Height: | Size: 157 KiB |
|
Before Width: | Height: | Size: 170 KiB |
BIN
assets/details/loaders/teleskopik_katta.png
Normal file
|
After Width: | Height: | Size: 202 KiB |