|
@@ -10,9 +10,21 @@ import { GoChevronLeft, GoChevronRight } from "react-icons/go";
|
|
|
import styles from "./customer.module.css";
|
|
|
import { fetchCustomers } from "@/lib/cms";
|
|
|
|
|
|
+interface CustomerType {
|
|
|
+ id: number;
|
|
|
+ name?: string | null;
|
|
|
+ avatar?: string | null;
|
|
|
+ title?: string | null;
|
|
|
+ content?: string | null;
|
|
|
+ order?: number | null;
|
|
|
+ status?: string | null;
|
|
|
+ createTime?: Date | null;
|
|
|
+ updateTime?: Date | null;
|
|
|
+}
|
|
|
+
|
|
|
export default function Services() {
|
|
|
const [swiperRef, setSwiperRef] = useState<SwiperClass | null>(null);
|
|
|
- const [customerList, setCustomerList] = useState(null);
|
|
|
+ const [customerList, setCustomerList] = useState<CustomerType[] | null>(null);
|
|
|
|
|
|
const slideToNext = () => {
|
|
|
swiperRef?.slideNext();
|
|
@@ -24,7 +36,8 @@ export default function Services() {
|
|
|
|
|
|
useEffect(() => {
|
|
|
fetchCustomers().then(({ data: list }) => {
|
|
|
- setCustomerList(list);
|
|
|
+ const records = [...list?.records];
|
|
|
+ setCustomerList(records);
|
|
|
});
|
|
|
}, []);
|
|
|
|
|
@@ -49,13 +62,13 @@ export default function Services() {
|
|
|
slidesPerView={isMobile ? 1 : 2}
|
|
|
onSwiper={setSwiperRef}
|
|
|
>
|
|
|
- {customerList?.records?.map((item, index) => {
|
|
|
+ {customerList?.map((item, index) => {
|
|
|
return (
|
|
|
<SwiperSlide key={index}>
|
|
|
<div className={styles["col-md-5"]}>
|
|
|
<div className={styles["card-item"]}>
|
|
|
<div className={styles["circle-box"]}>
|
|
|
- <Image alt="avatar" width={96} height={96} className={styles.img} src={item.avatar} />
|
|
|
+ <Image alt="avatar" width={96} height={96} className={styles.img} src={item.avatar!} />
|
|
|
</div>
|
|
|
<div className={styles["card-content"]}>
|
|
|
<div className={styles.group}>
|