notification base

This commit is contained in:
hamid zarghami
2025-12-20 09:49:23 +03:30
parent 694eda70af
commit 24cce65444
8 changed files with 295 additions and 1 deletions
@@ -0,0 +1,21 @@
import axios from "../../../config/axios";
import type { GetNotificationsResponse } from "../types/NotificationTypes";
export const getNotifications = async (
page: number,
status: "all" | "read" | "unread"
): Promise<GetNotificationsResponse> => {
let query = ``;
if (status !== "all") {
query = `&isRead=${status === "read" ? 1 : 0}`;
}
const { data } = await axios.get<GetNotificationsResponse>(
`/admin/notifications?page=${page}${query}`
);
return data;
};
export const readAll = async () => {
const { data } = await axios.patch(`/admin/notifications/read-all`);
return data;
};