Tre CORs fix

This commit is contained in:
DESKTOP-GBA0BK8\Admin
2023-04-19 23:11:38 -04:00
parent 1b3504f4e5
commit 58702ade71
2 changed files with 14 additions and 8 deletions
+4 -4
View File
@@ -9,11 +9,11 @@ REACT_APP_APPSITE="https://myfitapp.mermsemr.com"
# REACT_APP_AUX_ENDPOINT="http://10.20.30.32:9083/svs/user"
# REACT_APP_USERS_ENDPOINT="http://10.20.30.32:9083/svs/user"
# REACT_APP_AUX_ENDPOINT="https://apigate.lotus.g1.wrenchboard.com/svs/user"
# REACT_APP_USERS_ENDPOINT="https://apigate.lotus.g1.wrenchboard.com/svs/user"
REACT_APP_AUX_ENDPOINT="https://apigate.lotus.g1.wrenchboard.com/svs/user"
REACT_APP_USERS_ENDPOINT="https://apigate.lotus.g1.wrenchboard.com/svs/user"
REACT_APP_AUX_ENDPOINT="https://apigate.lotus.g1.wrenchboard.com/en/wrench/api/v1"
REACT_APP_USERS_ENDPOINT="https://apigate.lotus.g1.wrenchboard.com/en/wrench/api/v1"
#REACT_APP_AUX_ENDPOINT="https://apigate.lotus.g1.wrenchboard.com/en/wrench/api/v1"
#REACT_APP_USERS_ENDPOINT="https://apigate.lotus.g1.wrenchboard.com/en/wrench/api/v1"
#"https://devapi.mermsemr.com/en/desktop/api/v2/myfituser"
+10 -4
View File
@@ -253,16 +253,22 @@ class usersService {
postAuxEnd(uri, reqData) {
const endPoint = process.env.REACT_APP_USERS_ENDPOINT + uri;
const session_token = localStorage.getItem("session_token");
// session_token = session_token !=null ?session_token : '';
// 'Authorization': `Basic ${(session_token !=null) ?session_token : ''}`,
let axiosConfig = {
headers: {
'Accept': 'application/json',
'Access-Control-Allow-Origin': '*',
'Access-Control-Expose-Headers': 'Access-Control-Allow-Origin',
'Access-Control-Allow-Headers':'Origin, X-API-KEY, X-Requested-With, Content-Type, Accept, Access-Control-Request-Method, Access-Control-Allow-Headers, Authorization, observe, enctype, Content-Length, X-Csrf-Token',
'Content-Type': 'application/json;charset=UTF-8',
'Authorization': `Basic ${session_token}`,
}
};
// Axios.defaults.headers.post['Content-Type'] ='application/json;charset=utf-8';
// Axios.defaults.headers.post['Access-Control-Allow-Origin'] = '*'; //,axiosConfig
// Axios.defaults.headers.post['Access-Control-Allow-Origin'] = '*'; //,axiosConfig
// Axios.defaults.withCredentials = true;
//debugger;
return Axios.post(endPoint, reqData)
.then((response) => {
console.log(response);
@@ -279,12 +285,12 @@ class usersService {
} else if (error.request) {
//response not received though the request was sent
console.log("ERROR2-------------------------------------------------------");
console.log(error.request);
console.log(error?.request);
console.log("ERROR2-------------------------------------------------------");
} else {
//an error occurred when setting up the request
console.log("ERROR3-------------------------------------------------------");
console.log(error.message);
console.log(error);
console.log("ERROR3-------------------------------------------------------");
}
});