+
+
+
-
-
-
- منو دیجیتال رستوران
-
-
-
- دسته بندی
-
-
-
-
-
-
-
- دی منو
-
-
-
- داناک
+
+
+
+ {item.name}
+
+
+ {item.category.title}
+
+
+
+
+
+
+
+
+
+ {item.title}
+
+
+
+ داناک
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
- منو دیجیتال رستوران
-
-
-
- دسته بندی
-
-
-
-
-
-
-
- دی منو
-
-
-
- داناک
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- منو دیجیتال رستوران
-
-
-
- دسته بندی
-
-
-
-
-
-
-
- دی منو
-
-
-
- داناک
-
-
-
-
-
-
-
-
-
+
+ )
+ })
+ }
diff --git a/src/app/products/hooks/useProductData.ts b/src/app/products/hooks/useProductData.ts
index 04b7191..a6a5016 100644
--- a/src/app/products/hooks/useProductData.ts
+++ b/src/app/products/hooks/useProductData.ts
@@ -29,11 +29,22 @@ export const useGetCategories = () =>
queryFn: () => api.getCategoriesPublic(),
});
+export const useGetSliderProducts = () =>
+ useQuery({
+ queryKey: ["slider-products"],
+ queryFn: () => api.getSliderProducts(),
+ });
+
export const categoriesQueryOptions = {
queryKey: ["service-categories"],
queryFn: () => api.getCategoriesPublic(),
};
+export const sliderProductsQueryOptions = {
+ queryKey: ["slider-products"],
+ queryFn: () => api.getSliderProducts(),
+};
+
export const useGetDetailService = (serviceId: string) =>
useQuery({
queryKey: ["service-detail", serviceId],
diff --git a/src/app/products/page.tsx b/src/app/products/page.tsx
index e8a53a5..bdffd95 100644
--- a/src/app/products/page.tsx
+++ b/src/app/products/page.tsx
@@ -3,7 +3,7 @@ import { Suspense } from 'react'
import { HydrationBoundary } from '@tanstack/react-query'
import { dehydrate } from '@tanstack/react-query'
import { QueryClient } from '@tanstack/react-query'
-import { categoriesQueryOptions, danakServiceSuggestedQueryOptions, servicesQueryOptions } from './hooks/useProductData'
+import { categoriesQueryOptions, danakServiceSuggestedQueryOptions, servicesQueryOptions, sliderProductsQueryOptions } from './hooks/useProductData'
import Products from './ProductsPage'
import Loading from './loading'
@@ -20,6 +20,7 @@ async function ProductsContent() {
await queryClient.prefetchQuery(servicesQueryOptions)
await queryClient.prefetchQuery(categoriesQueryOptions)
await queryClient.prefetchQuery(danakServiceSuggestedQueryOptions)
+ await queryClient.prefetchQuery(sliderProductsQueryOptions)
return (
diff --git a/src/app/products/service/ProductService.ts b/src/app/products/service/ProductService.ts
index 4f79cb8..4ceebb4 100644
--- a/src/app/products/service/ProductService.ts
+++ b/src/app/products/service/ProductService.ts
@@ -4,6 +4,7 @@ import {
DanakServiceSuggestedResponse,
ServiceDetailResponse,
ServiceResponse,
+ SliderProductResponse,
} from "../types/ProductTypes";
export const getServicesByCategory = async (categoryId?: string) => {
@@ -37,3 +38,10 @@ export const getDetailService = async (serviceId: string) => {
);
return data;
};
+
+export const getSliderProducts = async () => {
+ const { data } = await axios.get(
+ `/danak-services/slider`
+ );
+ return data;
+};
diff --git a/src/app/products/types/ProductTypes.ts b/src/app/products/types/ProductTypes.ts
index 05425b9..705fb42 100644
--- a/src/app/products/types/ProductTypes.ts
+++ b/src/app/products/types/ProductTypes.ts
@@ -88,3 +88,7 @@ export type ServiceDetailResponse = ApiResponse<{
deletedAt: string | null;
averageRating: number;
}>;
+
+export type SliderProductResponse = ApiResponse<{
+ danakServices: DanakService[];
+}>;