refactor(actions): adopt endpoint client in reference data service

This commit is contained in:
2026-03-25 06:19:37 +00:00
parent 6fa7cf9375
commit eb3b6013b3
3 changed files with 64 additions and 49 deletions
+31 -49
View File
@@ -1,76 +1,58 @@
import axios from "axios";
import { BASE_URL } from "../core/env";
import { consoleLogger } from "../core/logger";
import { logAndReturnEmptyValueErrorResponse } from "./httpServiceUtils";
import { getJson } from "../clients/endpointClient";
export const getAppealsTypes = () => {
return axios
.get(BASE_URL + "/api/endpoint/getappealtypes_api")
.then((res) => res.data)
.catch(logAndReturnEmptyValueErrorResponse);
return getJson(BASE_URL + "/api/endpoint/getappealtypes_api").catch(
logAndReturnEmptyValueErrorResponse
);
};
export const getProjectTypes = () => {
return axios
.get(BASE_URL + "/api/endpoint/getprojecttypes_api")
.then((res) => res.data)
.catch(logAndReturnEmptyValueErrorResponse);
return getJson(BASE_URL + "/api/endpoint/getprojecttypes_api").catch(
logAndReturnEmptyValueErrorResponse
);
};
export const getAppealsTypesForNewAppeal = () => {
return axios
.get(BASE_URL + "/api/endpoint/getappealtypesfornewappeal_api")
.then((res) => res.data)
.catch(logAndReturnEmptyValueErrorResponse);
return getJson(
BASE_URL + "/api/endpoint/getappealtypesfornewappeal_api"
).catch(logAndReturnEmptyValueErrorResponse);
};
export const getLPA = () => {
return axios
.get(BASE_URL + "/api/endpoint/getlpa_api")
.then((res) => {
return res.data;
})
.catch(logAndReturnEmptyValueErrorResponse);
return getJson(BASE_URL + "/api/endpoint/getlpa_api").catch(
logAndReturnEmptyValueErrorResponse
);
};
export const getFormData = (whichForm) => {
return axios
.get(BASE_URL + "/api/endpoint/getformdata_api?whichForm=" + whichForm)
.then((res) => res.data)
.catch((error) => {
consoleLogger(error);
});
return getJson(
BASE_URL + "/api/endpoint/getformdata_api?whichForm=" + whichForm
).catch((error) => {
consoleLogger(error);
});
};
export const getMandatoryFields = (whichForm) => {
return axios
.get(
BASE_URL +
"/api/endpoint/getmandatoryfields_api?whichForm=" +
whichForm
)
.then((res) => res.data)
.catch((error) => {
consoleLogger(error);
});
return getJson(
BASE_URL + "/api/endpoint/getmandatoryfields_api?whichForm=" + whichForm
).catch((error) => {
consoleLogger(error);
});
};
export const getPickLists = (whichForm) => {
return axios
.get(BASE_URL + "/api/endpoint/getpicklists_api?whichForm=" + whichForm)
.then((res) => res.data)
.catch((error) => {
consoleLogger(error);
});
return getJson(
BASE_URL + "/api/endpoint/getpicklists_api?whichForm=" + whichForm
).catch((error) => {
consoleLogger(error);
});
};
export const getNotice = () => {
return axios
.get(BASE_URL + "/api/notices")
.then((res) => {
return res.data;
})
.catch((error) => {
consoleLogger(error);
});
return getJson(BASE_URL + "/api/notices").catch((error) => {
consoleLogger(error);
});
};