50 lines
1.6 KiB
JavaScript
50 lines
1.6 KiB
JavaScript
import axios from "axios"
|
|
|
|
//REACT_APP_EVENT_API='https://event-core.simbrellang.net'
|
|
axios.interceptors.request.use(
|
|
config => {
|
|
config.headers = {
|
|
Accept: "application/json",
|
|
"Access-Control-Allow-Origin": "*",
|
|
};
|
|
return config;
|
|
},
|
|
error => {
|
|
return Promise.reject(error);
|
|
}
|
|
);
|
|
const postAuxEnd = (path, postData, media=false) => {
|
|
const basePath = media ? process.env.REACT_APP_EVENT_API : 'https://event-core.simbrellang.net'
|
|
// const basePath = media ? 'http://209.195.2.27:5000' : 'http://209.195.2.27:5000'
|
|
//10.10.11.17
|
|
// const basePath = media ? 'http://10.10.11.17:5000' : 'http://10.10.11.17:5000'
|
|
return axios.post(`${basePath}${path}`, postData).then(res => {
|
|
return res
|
|
}).catch(err => {
|
|
// throw new Error(err.response.data.message);
|
|
throw new Error(err);
|
|
})
|
|
}
|
|
|
|
const getAuxEnd = (path, reqData= null) => {
|
|
const basePath = 'https://event-core.simbrellang.net'
|
|
//const basePath = 'http://209.195.2.27:5000'
|
|
return axios.get(`${basePath}${path}`,{ params: reqData }).then(res => {
|
|
return res
|
|
// localStorage.clear();
|
|
// window.location.href = `/login?sessionExpired=true`;
|
|
}).catch(err => {
|
|
throw new Error(err);
|
|
// throw new Error(err.response.data.message);
|
|
// return err
|
|
})
|
|
}
|
|
|
|
// FUNCTION TO GET SALARY RECEIVED
|
|
export const initiateDisburseRetrials = (reqData) => {
|
|
let postData = {
|
|
...reqData
|
|
}
|
|
return postAuxEnd('/autocall/retry-disbursement', postData, false)
|
|
}
|