Upstream sync

This commit is contained in:
Senad Uka
2018-05-30 08:52:10 +02:00
parent 8e52651172
commit 04debaf3e9
14 changed files with 540 additions and 233 deletions

View File

@@ -6,6 +6,9 @@ const Instance = () => {
const apiUrl = process.env.NODE_ENV === 'production'
? 'https://portal-api.bcbsinstitute.com'
: 'https://portal-api.dev.bcbsinstitute.com';
// const apiUrl = 'http://localhost:5100';
window.localStorage.setItem('App', '8a266a40-ed2e-4be2-bdfc-459a507bf02e');
let instance = axios.create({
@@ -61,11 +64,25 @@ const Instance = () => {
return setToken(token);
};
const getAPIUrl = (url) => {
if (!url) {
return instance;
} else {
const token = getCookie('token');
return axios.create({
baseURL: url,
timeout: 60000,
headers: { App: window.localStorage.getItem('App'), Token: `Bearer ${token}`, Token: `Bearer ${token}` },
});
}
}
const getRawConn = () => {
const token = getCookie('token');
if (token && token !== null && token !== '') {
return instance;
}
window.location.href = '/#/login';
return null;
};
@@ -80,6 +97,7 @@ const Instance = () => {
getConnection,
setToken,
getRawConn,
getAPIUrl,
};
};