import axios from "../../../config/axios";

export const getNotifications = async (
  page: number,
  status: "all" | "read" | "unread"
) => {
  let query = ``;
  if (status !== "all") {
    query = `&isRead=${status === "read" ? 1 : 0}`;
  }
  const { data } = await axios.get(`/notifications?page=${page}${query}`);
  return data;
};

export const readAll = async () => {
  const { data } = await axios.patch(`/notifications/read-all`);
  return data;
};
