import api from "src/api";

export const getAccessLogsPaginated = async ({
  page = 1,
  perPage = 10,
  type,
  date_from,
  date_to,
  last_per_user,
} = {}) => {
  const params = { page, per_page: perPage };
  if (type) params.type = type;
  if (date_from) params.date_from = date_from;
  if (date_to) params.date_to = date_to;
  if (last_per_user) params.last_per_user = true;

  const { data } = await api.get("/user-access-log", { params });
  return { data: { result: data.payload } };
};
