notification.js 590 B

123456789101112131415161718192021
  1. import api from "src/api";
  2. export const getMyNotifications = async () => {
  3. const { data } = await api.get("/notification/me");
  4. return data.payload;
  5. };
  6. export const getUnreadCount = async () => {
  7. const { data } = await api.get("/notification/me/unread-count");
  8. return data.payload?.count ?? 0;
  9. };
  10. export const markNotificationRead = async (id) => {
  11. const { data } = await api.post(`/notification/${id}/read`);
  12. return data.payload;
  13. };
  14. export const markAllNotificationsRead = async () => {
  15. const { data } = await api.post("/notification/read-all");
  16. return data.payload;
  17. };