Logging in working again.
This commit is contained in:
1 parent
e6874b8162
commit
33aef7433c
3 files changed
+6
-14
No files matched your search
@@ -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 {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user