48 lines
1.3 KiB
TypeScript
48 lines
1.3 KiB
TypeScript
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);
|
|
}
|
|
|
|
export async function approveAgent(id: string | number) {
|
|
const headers = {
|
|
"content-type": "application/json",
|
|
};
|
|
return await httpPutInterceptor(`/sales-agents/${id}/approve`, {}, headers);
|
|
} |