From 48441ffd9a92827ffedf5e0b0f4e490132e02c82 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Fri, 15 Nov 2024 15:59:52 +0700
Subject: <iman> update radis error code preferredBrand

---
 src/lib/home/components/PreferredBrand.jsx | 82 ++++++++++++++++--------------
 1 file changed, 44 insertions(+), 38 deletions(-)

(limited to 'src/lib/home/components/PreferredBrand.jsx')

diff --git a/src/lib/home/components/PreferredBrand.jsx b/src/lib/home/components/PreferredBrand.jsx
index eefced60..5a6a0570 100644
--- a/src/lib/home/components/PreferredBrand.jsx
+++ b/src/lib/home/components/PreferredBrand.jsx
@@ -1,49 +1,51 @@
-import { Swiper, SwiperSlide } from 'swiper/react'
-import  { Navigation, Pagination, Autoplay } from 'swiper';
-import { useCallback, useEffect, useState } from 'react'
-import usePreferredBrand from '../hooks/usePreferredBrand'
-import PreferredBrandSkeleton from './Skeleton/PreferredBrandSkeleton'
-import BrandCard from '@/lib/brand/components/BrandCard'
-import useDevice from '@/core/hooks/useDevice'
-import Link from '@/core/components/elements/Link/Link'
-import axios from 'axios'
+import { Swiper, SwiperSlide } from 'swiper/react';
+import { Navigation, Pagination, Autoplay } from 'swiper';
+import { useCallback, useEffect, useState } from 'react';
+import usePreferredBrand from '../hooks/usePreferredBrand';
+import PreferredBrandSkeleton from './Skeleton/PreferredBrandSkeleton';
+import BrandCard from '@/lib/brand/components/BrandCard';
+import useDevice from '@/core/hooks/useDevice';
+import Link from '@/core/components/elements/Link/Link';
+import axios from 'axios';
 
 const PreferredBrand = () => {
-  let query = ''
-  let params = 'prioritas'
-  const [isLoading, setIsLoading] = useState(true)
-  const [startWith, setStartWith] = useState(null)
-  const [manufactures, setManufactures] = useState([])
+  let query = '';
+  let params = 'prioritas';
+  const [isLoading, setIsLoading] = useState(true);
+  const [startWith, setStartWith] = useState(null);
+  const [manufactures, setManufactures] = useState([]);
 
   const loadBrand = useCallback(async () => {
-    setIsLoading(true)
-    const name = startWith ? `${startWith}*` : ''
-    const result = await axios(`${process.env.NEXT_PUBLIC_SELF_HOST}/api/shop/brands?rows=20`)
-    
-    setIsLoading(false)
-    setManufactures((manufactures) => [...result.data])
-  }, [startWith])
+    setIsLoading(true);
+    const name = startWith ? `${startWith}*` : '';
+    const result = await axios(
+      `${process.env.NEXT_PUBLIC_SELF_HOST}/api/shop/preferredBrand?rows=20`
+    );
+
+    setIsLoading(false);
+    setManufactures((manufactures) => [...result.data]);
+  }, [startWith]);
 
   const toggleStartWith = (alphabet) => {
-    setManufactures([])
+    setManufactures([]);
     if (alphabet == startWith) {
-      setStartWith(null)
-      return
+      setStartWith(null);
+      return;
     }
-    setStartWith(alphabet)
-  }
+    setStartWith(alphabet);
+  };
 
   useEffect(() => {
-    loadBrand()
-  }, [])
+    loadBrand();
+  }, []);
 
   // const { preferredBrands } = usePreferredBrand(query)
-  const { isMobile, isDesktop } = useDevice()
+  const { isMobile, isDesktop } = useDevice();
   const swiperBanner = {
-    modules:[Navigation, Pagination, Autoplay],
+    modules: [Navigation, Pagination, Autoplay],
     autoplay: {
       delay: 4000,
-      disableOnInteraction: false
+      disableOnInteraction: false,
     },
     loop: true,
     className: 'h-[70px] md:h-[100px] w-full',
@@ -53,13 +55,17 @@ const PreferredBrand = () => {
       dynamicBullets: true,
       dynamicMainBullets: isMobile ? 6 : 8,
       clickable: true,
-    }
-  }
-  const preferredBrandsData = manufactures ? manufactures.slice(0, 20) : []
+    },
+  };
+  const preferredBrandsData = manufactures ? manufactures.slice(0, 20) : [];
   return (
     <div className='px-4 sm:px-0'>
       <div className='flex justify-between items-center mb-4'>
-        <h1 className='font-semibold text-[14px] sm:text-h-lg'><Link href='/shop/brands' className='!text-black font-semibold'>Brand Pilihan</Link></h1>
+        <h1 className='font-semibold text-[14px] sm:text-h-lg'>
+          <Link href='/shop/brands' className='!text-black font-semibold'>
+            Brand Pilihan
+          </Link>
+        </h1>
         {isDesktop && (
           <Link href='/shop/brands' className='!text-red-500 font-semibold'>
             Lihat Semua
@@ -79,7 +85,7 @@ const PreferredBrand = () => {
         )}
       </div>
     </div>
-  )
-}
+  );
+};
 
-export default PreferredBrand
\ No newline at end of file
+export default PreferredBrand;
-- 
cgit v1.2.3


From 9e967a55c575d24b740620325838ab857e7eef04 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Fri, 15 Nov 2024 16:04:05 +0700
Subject: back to code

---
 src/lib/home/components/PreferredBrand.jsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'src/lib/home/components/PreferredBrand.jsx')

diff --git a/src/lib/home/components/PreferredBrand.jsx b/src/lib/home/components/PreferredBrand.jsx
index 5a6a0570..9fb1228a 100644
--- a/src/lib/home/components/PreferredBrand.jsx
+++ b/src/lib/home/components/PreferredBrand.jsx
@@ -19,7 +19,7 @@ const PreferredBrand = () => {
     setIsLoading(true);
     const name = startWith ? `${startWith}*` : '';
     const result = await axios(
-      `${process.env.NEXT_PUBLIC_SELF_HOST}/api/shop/preferredBrand?rows=20`
+      `${process.env.NEXT_PUBLIC_SELF_HOST}/api/shop/brands?rows=20`
     );
 
     setIsLoading(false);
-- 
cgit v1.2.3


From 607ddd5050b5ee900606984b60e74d094fbe89f9 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Fri, 15 Nov 2024 16:17:13 +0700
Subject: <iman> update fix code

---
 src/lib/home/components/PreferredBrand.jsx | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

(limited to 'src/lib/home/components/PreferredBrand.jsx')

diff --git a/src/lib/home/components/PreferredBrand.jsx b/src/lib/home/components/PreferredBrand.jsx
index 9fb1228a..b7a30503 100644
--- a/src/lib/home/components/PreferredBrand.jsx
+++ b/src/lib/home/components/PreferredBrand.jsx
@@ -19,9 +19,8 @@ const PreferredBrand = () => {
     setIsLoading(true);
     const name = startWith ? `${startWith}*` : '';
     const result = await axios(
-      `${process.env.NEXT_PUBLIC_SELF_HOST}/api/shop/brands?rows=20`
+      `${process.env.NEXT_PUBLIC_SELF_HOST}/api/shop/preferredBrand?rows=20`
     );
-
     setIsLoading(false);
     setManufactures((manufactures) => [...result.data]);
   }, [startWith]);
-- 
cgit v1.2.3

