diff --git a/src/app/(routes)/(website)/components/services/services.tsx b/src/app/(routes)/(website)/components/services/services.tsx index 86cf9b3..3b7c55c 100644 --- a/src/app/(routes)/(website)/components/services/services.tsx +++ b/src/app/(routes)/(website)/components/services/services.tsx @@ -1,17 +1,10 @@ "use client"; +import { Service } from "@/app/types/types"; import { useEffect, useState } from "react"; import Skeleton from "react-loading-skeleton"; import "react-loading-skeleton/dist/skeleton.css"; -type Service = { - id: number; - title: string; - description: string; - imageSrc: string; - altText: string; -}; - interface ServicesProps { dict: { homePage: { @@ -31,9 +24,7 @@ export default function Services({ dict }: ServicesProps) { useEffect(() => { const fetchServices = async () => { try { - const response = await fetch("/api/website/services", { - cache: "no-store", - }); + const response = await fetch("/api/website/services"); if (!response.ok) { throw new Error("Failed to fetch services"); @@ -55,7 +46,6 @@ export default function Services({ dict }: ServicesProps) { fetchServices(); }, []); - // تابع برای رندر کردن کارت سرویس const renderServiceCard = (service?: Service, index?: number) => (
{loading ? ( - + ) : ( {service!.altText} )}

{loading ? ( - + ) : ( service!.title )}

{loading ? ( - + ) : ( service!.description )} diff --git a/src/app/types/types.ts b/src/app/types/types.ts index cbdc58a..a184ca7 100644 --- a/src/app/types/types.ts +++ b/src/app/types/types.ts @@ -192,3 +192,11 @@ export type AboutMeDataType = { updated_at: string; skills: SkillType[]; }; + +export type Service = { + id: number; + title: string; + description: string; + imageSrc: string; + altText: string; +};