33 lines
842 B
TypeScript
33 lines
842 B
TypeScript
import { PaginationRequest } from "@/types/globals";
|
|
import {
|
|
httpDeleteInterceptor,
|
|
httpGet,
|
|
httpPost,
|
|
httpPut,
|
|
} from "./http-config/axios-base-service";
|
|
import Cookies from "js-cookie";
|
|
|
|
const token = Cookies.get("access_token");
|
|
|
|
export async function createMagazine(data: any) {
|
|
const headers = {
|
|
"content-type": "application/json",
|
|
Authorization: `Bearer ${token}`,
|
|
};
|
|
const pathUrl = `/magazines`;
|
|
return await httpPost(pathUrl, headers, data);
|
|
}
|
|
|
|
export async function getListMagazine(props: PaginationRequest) {
|
|
const { page, limit, search, startDate, endDate } = props;
|
|
const headers = {
|
|
"content-type": "application/json",
|
|
};
|
|
return await httpGet(
|
|
`/magazines?limit=${limit}&page=${page}&title=${search}&startDate=${
|
|
startDate || ""
|
|
}&endDate=${endDate || ""}`,
|
|
headers
|
|
);
|
|
}
|