"use client"; import React, { useEffect } from "react"; import EmptyState from "../reuseableUI/emptyState"; import Heading from "../reuseableUI/heading"; import { BrandsSwiperClient } from "./brandsSwiperClient"; import type { CategoryAPIType } from "@/lib/api/shopTypes"; import { partsLogicClient } from "@/lib/client/partslogic"; export const BrandsSwiper = () => { const [brandsData, setBrands] = React.useState([]); useEffect(() => { const fetchBrandsData = async () => { try { const resp = await partsLogicClient.getBrands(); if (resp.brands && Array.isArray(resp.brands)) setBrands(resp.brands); } catch (error) { console.error("Error fetching brands:", error); setBrands([]); } }; fetchBrandsData(); }, []); return (
{!brandsData.length ? (
) : ( )}
); };