@kadconsulting/dry
Version:
KAD Reusable Component Library
17 lines • 528 B
JavaScript
import axios from 'axios';
export const crudHelper = async (entity,
// entity: EntityType,
options, apiString) => {
const { method, id, data } = options;
const url = id ? `${apiString}/${entity}/${id}` : `${apiString}/${entity}`;
const config = {
method,
url,
data,
// TODO-p1: remove this one the API is optimized
timeout: 3600000, // 1 hour in milliseconds
};
const response = await axios(config);
return response.data;
};
//# sourceMappingURL=crudHelper.js.map