Client: file organization
This commit is contained in:
parent
3b13ee67c0
commit
c66f3fd9d7
@ -2,6 +2,7 @@ import React from 'react'
|
|||||||
import { Route, Switch } from 'react-router-dom'
|
import { Route, Switch } from 'react-router-dom'
|
||||||
|
|
||||||
import './App.css'
|
import './App.css'
|
||||||
|
import Dashboard from './Dashboard'
|
||||||
import Logout from './Logout'
|
import Logout from './Logout'
|
||||||
import NavBar from './NavBar'
|
import NavBar from './NavBar'
|
||||||
import UserForm from './User/UserForm'
|
import UserForm from './User/UserForm'
|
||||||
@ -16,38 +17,27 @@ export default class App extends React.Component {
|
|||||||
return (
|
return (
|
||||||
<div className="App">
|
<div className="App">
|
||||||
<NavBar />
|
<NavBar />
|
||||||
<div className="container">
|
<Switch>
|
||||||
<div className="row">
|
<Route exact path="/" component={Dashboard} />
|
||||||
<div className="col-md-6">
|
<Route
|
||||||
<br />
|
exact path="/register"
|
||||||
<Switch>
|
render={() => (
|
||||||
<Route
|
<UserForm
|
||||||
exact path="/register"
|
formType={'Register'}
|
||||||
render={() => (
|
/>
|
||||||
<UserForm
|
)}
|
||||||
formType={'Register'}
|
/>
|
||||||
/>
|
<Route
|
||||||
)}
|
exact path="/login"
|
||||||
/>
|
render={() => (
|
||||||
<Route
|
<UserForm
|
||||||
exact path="/login"
|
formType={'Login'}
|
||||||
render={() => (
|
/>
|
||||||
<UserForm
|
)}
|
||||||
formType={'Login'}
|
/>
|
||||||
/>
|
<Route exact path="/logout" component={Logout} />
|
||||||
)}
|
</Switch>
|
||||||
/>
|
</div>
|
||||||
<Route
|
|
||||||
exact path="/logout"
|
|
||||||
render={() => (
|
|
||||||
<Logout />
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
</Switch>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
19
mpwo_client/src/components/Dashboard/index.jsx
Normal file
19
mpwo_client/src/components/Dashboard/index.jsx
Normal 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)
|
@ -2,7 +2,7 @@ import React from 'react'
|
|||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import { Link } from 'react-router-dom'
|
import { Link } from 'react-router-dom'
|
||||||
|
|
||||||
import { logout } from '../actions'
|
import { logout } from '../../actions'
|
||||||
|
|
||||||
class Logout extends React.Component {
|
class Logout extends React.Component {
|
||||||
componentDidMount() {
|
componentDidMount() {
|
@ -28,7 +28,7 @@ function NavBar (props) {
|
|||||||
pathname: '/',
|
pathname: '/',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Home
|
Dashboard
|
||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
{!props.user.isAuthenticated && (
|
{!props.user.isAuthenticated && (
|
Loading…
Reference in New Issue
Block a user