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