diff --git a/client/src/components/LoggedInUser.js b/client/src/components/LoggedInUser.js
index 656b66927..0f69114c6 100644
--- a/client/src/components/LoggedInUser.js
+++ b/client/src/components/LoggedInUser.js
@@ -1,14 +1,14 @@
import React, { Component } from 'react'
import {graphql} from 'react-apollo'
import {getUserByAuthIdQuery} from '../queries/queries'
-import {auth} from '../App'
+
import LoggedInUserMenu from './LoggedInUserMenu'
import Button from '@material-ui/core/Button'
class LoggedInUser extends Component {
displayLoggedInUser () {
- const user = this.props.data.userByAuthId
+ const user = this.props.data.users_UserByAuthId
if (user) {
let displayName = 'No Display Name'
@@ -40,7 +40,7 @@ class LoggedInUser extends Component {
)
} else {
return (
-
auth.login()}>
+
)
@@ -52,11 +52,12 @@ class LoggedInUser extends Component {
}
render () {
+ console.log('props', this.props)
if (this.loggedInUserStored !== true) {
- let user = this.props.data.userByAuthId
+ let user = this.props.data.users_UserByAuthId
if (user !== undefined) {
- localStorage.setItem('loggedInUser', JSON.stringify(this.props.data.userByAuthId))
+ localStorage.setItem('loggedInUser', JSON.stringify(this.props.data.users_UserByAuthId))
this.loggedInUserStored = true
}
}
diff --git a/client/src/components/NavBar.js b/client/src/components/NavBar.js
index a5ff91754..88b43814e 100644
--- a/client/src/components/NavBar.js
+++ b/client/src/components/NavBar.js
@@ -16,6 +16,9 @@ import UserIcon from '@material-ui/icons/Person'
import { Link } from 'react-router-dom'
+// components
+import LoggedInUser from './LoggedInUser'
+
const UserLink = props =>
const AboutLink = props =>
const ContactLink = props =>
@@ -52,7 +55,18 @@ class NavBar extends Component {
}
componentDidMount () {
- const authId = localStorage.getItem('authId')
+ let user = localStorage.getItem('user')
+
+ console.log('componentDidMount user', user)
+
+ let authId
+
+ if (user !== null && user !== undefined && user !== 'undefined') {
+ user = JSON.parse(user)
+ authId = user.authId
+ }
+
+ console.log('componentDidMount authId', authId)
if (authId !== null && authId !== undefined && authId !== 'undefined') {
this.setState({ authId: authId })
@@ -106,6 +120,7 @@ class NavBar extends Component {
component={UserLink}>
+