fix saving data of current user after logging in

This commit is contained in:
igoradamenko
2018-02-14 01:29:52 +02:00
parent b901bc2e96
commit 12cf3d7264
+3 -3
View File
@@ -54,7 +54,7 @@ export default class Root extends Component {
}
onSignIn(provider) {
const newWindow = window.open(`${baseUrl}/auth/${provider}/login?from=${location.href}`);
const newWindow = window.open(`${baseUrl}/auth/${provider}/login?from=${encodeURIComponent(location.href)}`);
let secondsPass = 0;
const checkMsDelay = 200;
@@ -65,8 +65,8 @@ export default class Root extends Component {
clearInterval(checkInterval);
newWindow.close();
api.getUser()
.then(data => {
store.set('user', data);
.then(user => {
store.set('user', user);
this.setState({ user });
})
.catch(() => {}) // TODO: we need to handle it and write error to user