loader: error handling

This commit is contained in:
muerwre 2018-12-11 12:44:10 +07:00
parent 71a0aed9aa
commit 1c014ec9fb
5 changed files with 102 additions and 12 deletions

View file

@ -11,7 +11,7 @@ export const checkUserToken = ({ id, token }) => axios.get(API.CHECK_TOKEN, {
id,
token,
routes: (result.data.routes && result.data.routes.length > 0 && arrayToObject(result.data.routes, '_id')) || {},
}));
})).catch(() => null);
export const getGuestToken = () => axios.get(API.GET_GUEST).then(result => (result && result.data));

View file

@ -26,3 +26,11 @@ export const parseQuery = (queryString: string) => {
}
return params;
};
export const pushLoaderState = state => {
document.getElementById('loader-bar').style.width = `${state}%`;
};
export const pushNetworkInitError = state => {
document.getElementById('loader-error').style.opacity = 1;
};