notification infiti scroll

This commit is contained in:
hamid zarghami
2025-12-21 14:41:21 +03:30
parent 990e3f9f63
commit 2a1c81181e
6 changed files with 103 additions and 39 deletions
@@ -2,15 +2,16 @@ import axios from "../../../config/axios";
import type { GetNotificationsResponse } from "../types/NotificationTypes";
export const getNotifications = async (
page: number,
status: "all" | "read" | "unread"
cursor: string | undefined,
status: "all" | "seen" | "unseen"
): Promise<GetNotificationsResponse> => {
let query = ``;
if (status !== "all") {
query = `&isRead=${status === "read" ? 1 : 0}`;
query = `&status=${status}`;
}
const cursorParam = cursor ? `&cursor=${cursor}` : ``;
const { data } = await axios.get<GetNotificationsResponse>(
`/admin/notifications?page=${page}${query}`
`/admin/notifications?limit=10${cursorParam}${query}`
);
return data;
};