jaecoo-kelapagading/service/agent.ts

38 lines
1.0 KiB
TypeScript
Raw Normal View History

2025-11-18 06:56:39 +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 pathUrl = `/sales-agents`;
return await httpPostInterceptor(pathUrl, data);
}
export async function updateAgent(id: number, data: any) {
const pathUrl = `/sales-agents/${id}`;
return await httpPutInterceptor(pathUrl, data);
}
export async function deleteAgent(id: string) {
const headers = {
"content-type": "application/json",
};
return await httpDeleteInterceptor(`sales-agents/${id}`, headers);
}