notification infiti scroll
This commit is contained in:
@@ -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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user