web-humas-fe/services/http-config/http-disestages-2-services.ts

71 lines
2.0 KiB
TypeScript

import axiosDisestagesInstance2 from "./axios-disestages-instance-2";
export async function httpPostDisestages(pathUrl: any, headers: any, data?: any) {
const response = await axiosDisestagesInstance2
.post(pathUrl, data, { headers })
.catch(function (error) {
console.log(error);
return error.response;
});
console.log("Response base svc : ", response);
if (response?.status == 200 || response?.status == 201) {
return {
error: false,
message: "success",
data: response?.data,
};
} else {
return {
error: true,
message: response?.data?.message || response?.data || null,
data: null,
};
}
}
export async function httpGetDisestages(pathUrl: any, headers: any) {
const response = await axiosDisestagesInstance2
.get(pathUrl, { headers })
.catch(function (error) {
console.log(error);
return error.response;
});
console.log("Response base svc : ", response);
if (response?.status == 200 || response?.status == 201) {
return {
error: false,
message: "success",
data: response?.data,
};
} else {
return {
error: true,
message: response?.data?.message || response?.data || null,
data: null,
};
}
}
// export async function httpDelete(pathUrl: any) {
// const response = await axiosDisestagesInstance
// .delete(pathUrl, data, { headers })
// .catch(function (error) {
// console.log(error);
// return error.response;
// });
// console.log("Response base svc : ", response);
// if (response?.status == 200 || response?.status == 201) {
// return {
// error: false,
// message: "success",
// data: response?.data,
// };
// } else {
// return {
// error: true,
// message: response?.data?.message || response?.data || null,
// data: null,
// };
// }
// }