text: import React, {Component} from 'react'
  import {connect} from 'react-redux'
  import {Router} from 'react-router'
  import {Route, Switch} from 'react-router-dom'
  import PropTypes from 'prop-types'
  import history from './history'
  import {Main, Login, Signup, } from './components'
  import {me} from './store'
  
  /**
   * COMPONENT
   */
  class Routes extends Component {
    componentDidMount () {
      this.props.loadInitialData()
    }
  
    render () {
      const {isLoggedIn} = this.props
  
      return (
        <Router history={history}>
          <Main>
            <Switch>
              <Route path="/login" component={Login} />
              <Route path="/signup" component={Signup} />
              {
                isLoggedIn &&
                  <Switch>
                    <Route path="/home" component={Home} />
                  </Switch>
              }
              <Route component={Login} />
            </Switch>
          </Main>
        </Router>
      )
    }
  }
  
  const mapState = (state) => {
    return {
      isLoggedIn: !!state.user.id
    }
  }
  
  const mapDispatch = (dispatch) => {
    return {
      loadInitialData () {
        dispatch(me())
      }
    }
  }
  
  export default connect(mapState, mapDispatch)(Routes)
  
  Routes.propTypes = {
    loadInitialData: PropTypes.func.isRequired,
    isLoggedIn: PropTypes.bool.isRequired
  }
  