#129: do not render app, if we are on oauth request, that resolves to redirect

This commit is contained in:
SleepWalker
2016-06-02 20:46:49 +03:00
parent 3478c25342
commit 1ff6a05414
5 changed files with 28 additions and 7 deletions

View File

@@ -37,7 +37,10 @@ userFactory(store)
ReactDOM.render(
<ReduxProvider store={store}>
<IntlProvider>
<Router history={browserHistory} onUpdate={restoreScroll}>
<Router history={browserHistory} onUpdate={() => {
restoreScroll();
stopLoading();
}}>
{routesFactory(store)}
</Router>
</IntlProvider>
@@ -45,7 +48,6 @@ userFactory(store)
document.getElementById('app')
);
document.getElementById('loader').classList.remove('is-active');
});
/**
@@ -66,7 +68,13 @@ function restoreScroll() {
}, 100);
}
function stopLoading() {
document.getElementById('loader').classList.remove('is-active');
}
if (process.env.NODE_ENV !== 'production') {
// some shortcuts for testing on localhost
window.testOAuth = () => location.href = '/oauth?client_id=ely&redirect_uri=http%3A%2F%2Fely.by&response_type=code&scope=minecraft_server_session';
window.testOAuthStatic = () => location.href = '/oauth?client_id=ely&redirect_uri=static_page_with_code&response_type=code&scope=minecraft_server_session';
window.testOAuthStaticCode = () => location.href = '/oauth?client_id=ely&redirect_uri=static_page&response_type=code&scope=minecraft_server_session';
}