old version placed

This commit is contained in:
2024-12-31 12:22:36 +03:00
parent 08b7ad5c00
commit 00acc8c320
93 changed files with 7481 additions and 1 deletions

View File

@@ -0,0 +1,52 @@
"use server";
import { fetchDataWithToken, updateDataWithToken } from "../api-fetcher";
import {
baseUrl,
FilterList,
FilterListInterface,
defaultFilterList,
} from "../basics";
const CompanyListEndpoint = `${baseUrl}/company/list`;
const CompanyCreateEndpoint = `${baseUrl}/company/create`;
const CompanyUpdateEndpoint = `${baseUrl}/company/update`;
interface CompanyUpdateInterface {
uuid: string;
payload: any;
}
async function retrieveCompanyList(payload: FilterListInterface) {
const feedObject = new FilterList(payload).filter();
const tokenResponse: any = await fetchDataWithToken(
CompanyListEndpoint,
feedObject,
"POST",
false
);
return tokenResponse;
}
async function updateCompany(payload: any) {
const { uu_id: extractedField, ...payloadBody } = payload;
const tokenResponse: any = await updateDataWithToken(
CompanyUpdateEndpoint,
extractedField,
payloadBody,
"POST",
false
);
return tokenResponse;
}
async function createCompany(payload: any) {
const tokenResponse: any = await fetchDataWithToken(
CompanyCreateEndpoint,
payload,
"POST",
false
);
return tokenResponse;
}
export { retrieveCompanyList, updateCompany, createCompany };