import './../bootstrap'
import React, { Component } from 'react'
import { connect } from 'react-redux'
import { Route, Switch } from 'react-router-dom'
import {withRouter} from "react-router-dom"
import Header from './Header'
import Login from './Login'
import Footer from './Footer'
class App extends Component {
componentWillMount() {
if ( ! this.props.auth ) {
this.props.history.push( '/user/login' )
}
}
render() {
return (
<div>
<Header />
<Switch>
<Route path='/user/login' component={Login}/>
</Switch>
<Footer />
</div>
)
}
}
const mapStateToProps = state => {
return {
auth: state.auth
}
}
export default connect( mapStateToProps )( withRouter( App ) )
export default connect( mapStateToProps )( withRouter( App ) )
export default withRouter( connect( mapStateToProps )( App ) )
this.setState({ currentUrl: '/user/login' })