2016-10-05 13:36:47 -04:00
|
|
|
var connect = require('react-redux').connect;
|
|
|
|
|
|
|
|
var UserActions = require('../actions/UserActions');
|
|
|
|
var ErrorActions = require('../actions/ErrorActions');
|
|
|
|
|
2016-10-05 13:45:09 -04:00
|
|
|
var TopBar = require('../components/TopBar');
|
2016-10-05 13:36:47 -04:00
|
|
|
|
|
|
|
function mapStateToProps(state) {
|
|
|
|
return {
|
|
|
|
user: state.user,
|
|
|
|
error: state.error
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function mapDispatchToProps(dispatch) {
|
|
|
|
return {
|
|
|
|
onLogin: function(user) {dispatch(UserActions.login(user))},
|
|
|
|
onLogout: function() {dispatch(UserActions.logout())},
|
|
|
|
onUpdateUser: function(user) {dispatch(UserActions.update(user))},
|
|
|
|
onClearError: function() {dispatch(ErrorActions.clearError())}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = connect(
|
|
|
|
mapStateToProps,
|
|
|
|
mapDispatchToProps
|
|
|
|
)(TopBar)
|