Logging in working again.

This commit is contained in:
Luis Fernando Molina committed 2018-09-09 11:06:26 +02:00
1 parent e6874b8162
commit 33aef7433c
3 files changed
+6 -14

No files matched your search

+1 -1
View File
@@ -128,7 +128,7 @@ class Auth {
})
console.log('signinOrCreateAccount auth: ', await data)
setItem('user', data.data.authenticate.authId)
setItem('user', JSON.stringify(data.data.authenticate))
if (window.location.href.includes(`callback`)) {
window.location.href = '/'
} else {
+3
View File
@@ -11,6 +11,9 @@ class LoggedInUser extends Component {
const user = this.props.data.userByAuthId;
console.log('loggedInUser');
console.log(user);
if(user){
console.log(user.firstName);
+2 -13
View File
@@ -49,24 +49,13 @@ class NavBar extends Component {
}
componentDidMount() {
/*
this._asyncRequest = window.localStorage.getItem('user').then(
response => {
this._asyncRequest = null;
let user = JSON.parse(response)
if (user) {
const authId = user.sub;
this.setState({ authId: authId });
}
}
);
*/
const userStored = localStorage.getItem('user');
console.log(userStored);
if (userStored !== null && userStored !== undefined && userStored !== 'undefined') {
const user = JSON.parse(userStored);
const authId = user.sub;
const authId = user.authId;
this.setState({ authId: authId });
}
}