Client: file organization

This commit is contained in:
SamR1 2017-12-25 18:19:28 +01:00
parent 3b13ee67c0
commit c66f3fd9d7
4 changed files with 43 additions and 34 deletions

View File

@ -2,6 +2,7 @@ import React from 'react'
import { Route, Switch } from 'react-router-dom'
import './App.css'
import Dashboard from './Dashboard'
import Logout from './Logout'
import NavBar from './NavBar'
import UserForm from './User/UserForm'
@ -16,11 +17,8 @@ export default class App extends React.Component {
return (
<div className="App">
<NavBar />
<div className="container">
<div className="row">
<div className="col-md-6">
<br />
<Switch>
<Route exact path="/" component={Dashboard} />
<Route
exact path="/register"
render={() => (
@ -37,17 +35,9 @@ export default class App extends React.Component {
/>
)}
/>
<Route
exact path="/logout"
render={() => (
<Logout />
)}
/>
<Route exact path="/logout" component={Logout} />
</Switch>
</div>
</div>
</div>
</div>
)
}
}

View File

@ -0,0 +1,19 @@
import React from 'react'
import { connect } from 'react-redux'
class Logout extends React.Component {
componentDidMount() {}
render() {
return (
<div>
<h1>Dashboard</h1>
</div>
)
}
}
export default connect(
state => ({
user: state.user,
})
)(Logout)

View File

@ -2,7 +2,7 @@ import React from 'react'
import { connect } from 'react-redux'
import { Link } from 'react-router-dom'
import { logout } from '../actions'
import { logout } from '../../actions'
class Logout extends React.Component {
componentDidMount() {

View File

@ -28,7 +28,7 @@ function NavBar (props) {
pathname: '/',
}}
>
Home
Dashboard
</Link>
</li>
{!props.user.isAuthenticated && (