Logged In section only accesible when logged in

This commit is contained in:
Luis Fernando Molina committed 2018-10-14 09:56:13 +02:00
1 parent 853351f63a
commit 60ede64c19
2 files changed
+3 -12

No files matched your search

+1 -5
View File
@@ -2,7 +2,6 @@ import React, { Component } from 'react'
import {graphql} from 'react-apollo'
import {getUserByAuthIdQuery} from '../queries/queries'
import LoggedInUserMenu from './LoggedInUserMenu'
import Button from '@material-ui/core/Button'
import IconButton from '@material-ui/core/IconButton'
@@ -53,9 +52,7 @@ class LoggedInUser extends Component {
)
} else {
return (
<div>
<Button color='inherit'>Login / Sign up</Button>
</div>
<div />
)
}
}
@@ -65,7 +62,6 @@ class LoggedInUser extends Component {
}
render () {
console.log('props', this.props)
if (this.loggedInUserStored !== true) {
let user = this.props.data.users_UserByAuthId
+2 -7
View File
@@ -7,7 +7,7 @@ import Typography from '@material-ui/core/Typography'
import IconButton from '@material-ui/core/IconButton'
// icons
import HomeIcon from '@material-ui/icons/Home'
import UsersIcon from '@material-ui/icons/People'
import BrowseIcon from '@material-ui/icons/ImportContacts'
import SearchIcon from '@material-ui/icons/Search'
import ContactIcon from '@material-ui/icons/ContactMail'
@@ -54,9 +54,6 @@ class NavBar extends Component {
componentDidMount () {
let user = localStorage.getItem('user')
console.log('componentDidMount user', user)
let authId
if (user !== null && user !== undefined && user !== 'undefined') {
@@ -64,8 +61,6 @@ class NavBar extends Component {
authId = user.authId
}
console.log('componentDidMount authId', authId)
if (authId !== null && authId !== undefined && authId !== 'undefined') {
this.setState({ authId: authId })
}
@@ -81,7 +76,7 @@ class NavBar extends Component {
color='inherit'
title='Home'
component={HomeLink}>
<HomeIcon />
<UsersIcon />
</IconButton>
<IconButton
className={classes.menuButton}