From 9248fe3cee32e6cd02e2e795e71a9a4cee7d7ea5 Mon Sep 17 00:00:00 2001 From: hamid zarghami Date: Wed, 10 Dec 2025 09:03:56 +0330 Subject: [PATCH] basse notification --- .../(Dialogs)/notifications/hooks/useNotificationData.ts | 9 +++++++++ src/app/[name]/(Dialogs)/notifications/page.tsx | 4 ++++ .../notifications/service/NotificationService.ts | 6 ++++++ 3 files changed, 19 insertions(+) create mode 100644 src/app/[name]/(Dialogs)/notifications/hooks/useNotificationData.ts create mode 100644 src/app/[name]/(Dialogs)/notifications/service/NotificationService.ts diff --git a/src/app/[name]/(Dialogs)/notifications/hooks/useNotificationData.ts b/src/app/[name]/(Dialogs)/notifications/hooks/useNotificationData.ts new file mode 100644 index 0000000..49dd7fb --- /dev/null +++ b/src/app/[name]/(Dialogs)/notifications/hooks/useNotificationData.ts @@ -0,0 +1,9 @@ +import * as api from "../service/NotificationService"; +import { useQuery } from "@tanstack/react-query"; + +export const useGetNotifications = () => { + return useQuery({ + queryKey: ["notifications"], + queryFn: api.getNotifications, + }); +}; diff --git a/src/app/[name]/(Dialogs)/notifications/page.tsx b/src/app/[name]/(Dialogs)/notifications/page.tsx index 80abbc6..73b2959 100644 --- a/src/app/[name]/(Dialogs)/notifications/page.tsx +++ b/src/app/[name]/(Dialogs)/notifications/page.tsx @@ -5,12 +5,16 @@ import { ArrowLeft, Trash } from 'iconsax-react'; import { useRouter } from 'next/navigation'; import React from 'react' import { useTranslation } from 'react-i18next'; +import { useGetNotifications } from './hooks/useNotificationData'; type Props = object export default function NotificationsIndex({ }: Props) { + + const { t } = useTranslation('notifications') const router = useRouter(); + const { data } = useGetNotifications(); return (
diff --git a/src/app/[name]/(Dialogs)/notifications/service/NotificationService.ts b/src/app/[name]/(Dialogs)/notifications/service/NotificationService.ts new file mode 100644 index 0000000..b82cece --- /dev/null +++ b/src/app/[name]/(Dialogs)/notifications/service/NotificationService.ts @@ -0,0 +1,6 @@ +import { api } from "@/config/axios"; + +export const getNotifications = async () => { + const { data } = await api.get("/public/notifications"); + return data; +};