import DesktopView from '@/core/components/views/DesktopView'; import MobileView from '@/core/components/views/MobileView'; import Image from 'next/image'; import { Swiper, SwiperSlide } from 'swiper/react'; import { Autoplay } from 'swiper'; import { useEffect, useState } from 'react'; const { useQuery } = require('react-query'); const { getCustomerReviews } = require('../api/customerReviewsApi'); const CustomerReviews = () => { const [data, setData] = useState(null); useEffect(() => { const localData = localStorage.getItem('Homepage_customerReviews'); if (localData) { setData(JSON.parse(localData)); } },[]) const { data: fetchCustomerReviews } = useQuery( 'customerReviews', getCustomerReviews,{ enabled: !data, onSuccess: (data) => { if (data) { localStorage.setItem('Homepage_customerReviews', JSON.stringify(data)); setData(data); } } } ); const customerReviews = data return (

Ulasan Konsumen Kami

{customerReviews && customerReviews?.map((customerReview) => ( ))} {customerReviews && customerReviews?.map((customerReview) => ( ))}
); }; const swiperProps = { autoplay: { delay: 6000, disableOnInteraction: false, }, loop: true, modules: [Autoplay], }; const Card = ({ customerReview }) => (
{customerReview.customerName}
{customerReview.customerName}
); export default CustomerReviews;