jaecoo-cihampelas/service/agent.ts

42 lines
1.1 KiB
TypeScript
Raw Normal View History

2026-01-07 08:06:07 +00:00
import { PaginationRequest } from "@/types/globals";
import {
httpDeleteInterceptor,
httpGetInterceptor,
httpPostInterceptor,
httpPutInterceptor,
} from "./http-config/http-interceptor-services";
import { httpGet } from "./http-config/http-base-services";
export async function getAgentData(props: PaginationRequest) {
const { page, limit, search } = props;
return await httpGetInterceptor(`/sales-agents`);
}
export async function getAgentById(id: any) {
const headers = {
"content-type": "application/json",
};
return await httpGet(`/sales-agents/${id}`, headers);
}
export async function createAgent(data: any) {
const headers = {
"content-type": "multipart/form-data",
};
return await httpPostInterceptor(`/sales-agents`, data, headers);
}
export async function updateAgent(id: number, data: any) {
const headers = {
"content-type": "multipart/form-data",
};
return await httpPutInterceptor(`/sales-agents/${id}`, data, headers);
}
export async function deleteAgent(id: string) {
const headers = {
"content-type": "application/json",
};
return await httpDeleteInterceptor(`sales-agents/${id}`, headers);
}