old version placed
This commit is contained in:
52
apicalls/building/build.tsx
Normal file
52
apicalls/building/build.tsx
Normal file
@@ -0,0 +1,52 @@
|
||||
"use server";
|
||||
import { fetchDataWithToken, updateDataWithToken } from "../api-fetcher";
|
||||
import {
|
||||
baseUrl,
|
||||
FilterList,
|
||||
FilterListInterface,
|
||||
defaultFilterList,
|
||||
} from "../basics";
|
||||
|
||||
const buildListEndpoint = `${baseUrl}/building/build/list`;
|
||||
const buildCreateEndpoint = `${baseUrl}/building/build/create`;
|
||||
const buildUpdateEndpoint = `${baseUrl}/building/build/update`;
|
||||
|
||||
async function retrieveBuildList(payload: FilterListInterface) {
|
||||
const feedObject = new FilterList(payload).filter();
|
||||
const tokenResponse: any = await fetchDataWithToken(
|
||||
buildListEndpoint,
|
||||
feedObject,
|
||||
"POST",
|
||||
false
|
||||
);
|
||||
return tokenResponse;
|
||||
}
|
||||
|
||||
interface BuildUpdateInterface {
|
||||
uuid: string;
|
||||
payload: any;
|
||||
}
|
||||
|
||||
async function updateBuild(payload: any) {
|
||||
const { uu_id: extractedField, ...payloadBody } = payload;
|
||||
const tokenResponse: any = await updateDataWithToken(
|
||||
buildUpdateEndpoint,
|
||||
extractedField,
|
||||
payloadBody,
|
||||
"POST",
|
||||
false
|
||||
);
|
||||
return tokenResponse;
|
||||
}
|
||||
|
||||
async function createBuild(payload: any) {
|
||||
const tokenResponse: any = await fetchDataWithToken(
|
||||
buildCreateEndpoint,
|
||||
payload,
|
||||
"POST",
|
||||
false
|
||||
);
|
||||
return tokenResponse;
|
||||
}
|
||||
|
||||
export { retrieveBuildList, updateBuild, createBuild };
|
||||
40
apicalls/building/livingSpace.tsx
Normal file
40
apicalls/building/livingSpace.tsx
Normal file
@@ -0,0 +1,40 @@
|
||||
"use server";
|
||||
import { fetchData, fetchDataWithToken } from "../api-fetcher";
|
||||
import { baseUrl, FilterList, FilterListInterface } from "../basics";
|
||||
|
||||
const livingSpaceListEndpoint = `${baseUrl}/building/living_space/list`;
|
||||
const livingSpaceCreateEndpoint = `${baseUrl}/building/living_space/create`;
|
||||
const livingSpaceUpdateEndpoint = `${baseUrl}/building/living_space/update`;
|
||||
|
||||
async function retrievelivingSpaceList(payload: FilterListInterface) {
|
||||
const feedObject = new FilterList(payload).filter();
|
||||
const tokenResponse: any = await fetchDataWithToken(
|
||||
livingSpaceListEndpoint,
|
||||
feedObject,
|
||||
"POST",
|
||||
false
|
||||
);
|
||||
return tokenResponse;
|
||||
}
|
||||
|
||||
async function createLivingSpace(payload: any) {
|
||||
const tokenResponse: any = await fetchDataWithToken(
|
||||
livingSpaceCreateEndpoint,
|
||||
payload,
|
||||
"POST",
|
||||
true
|
||||
);
|
||||
return tokenResponse;
|
||||
}
|
||||
|
||||
async function updateLivingSpace(payload: any) {
|
||||
const tokenResponse: any = await fetchDataWithToken(
|
||||
livingSpaceUpdateEndpoint,
|
||||
payload,
|
||||
"POST",
|
||||
true
|
||||
);
|
||||
return tokenResponse;
|
||||
}
|
||||
|
||||
export { retrievelivingSpaceList, createLivingSpace, updateLivingSpace };
|
||||
52
apicalls/building/parts.tsx
Normal file
52
apicalls/building/parts.tsx
Normal file
@@ -0,0 +1,52 @@
|
||||
"use server";
|
||||
import { fetchDataWithToken, updateDataWithToken } from "../api-fetcher";
|
||||
import {
|
||||
baseUrl,
|
||||
FilterList,
|
||||
FilterListInterface,
|
||||
defaultFilterList,
|
||||
} from "../basics";
|
||||
|
||||
const partsListEndpoint = `${baseUrl}/building/parts/list`;
|
||||
const partsCreateEndpoint = `${baseUrl}/building/parts/create`;
|
||||
const partsUpdateEndpoint = `${baseUrl}/building/parts/update`;
|
||||
|
||||
interface BuildUpdateInterface {
|
||||
uuid: string;
|
||||
payload: any;
|
||||
}
|
||||
|
||||
async function retrievePartsList(payload: FilterListInterface) {
|
||||
const feedObject = new FilterList(payload).filter();
|
||||
const tokenResponse: any = await fetchDataWithToken(
|
||||
partsListEndpoint,
|
||||
feedObject,
|
||||
"POST",
|
||||
false
|
||||
);
|
||||
return tokenResponse;
|
||||
}
|
||||
|
||||
async function updateParts(payload: any) {
|
||||
const { uu_id: extractedField, ...payloadBody } = payload;
|
||||
const tokenResponse: any = await updateDataWithToken(
|
||||
partsUpdateEndpoint,
|
||||
extractedField,
|
||||
payloadBody,
|
||||
"POST",
|
||||
false
|
||||
);
|
||||
return tokenResponse;
|
||||
}
|
||||
|
||||
async function createParts(payload: any) {
|
||||
const tokenResponse: any = await fetchDataWithToken(
|
||||
partsCreateEndpoint,
|
||||
payload,
|
||||
"POST",
|
||||
false
|
||||
);
|
||||
return tokenResponse;
|
||||
}
|
||||
|
||||
export { retrievePartsList, updateParts, createParts };
|
||||
Reference in New Issue
Block a user