spee.ch/react/containers/ShowChannel/index.js

43 lines
1.3 KiB
JavaScript
Raw Normal View History

import { connect } from 'react-redux';
import {newChannelRequest, updateRequestError, showNewChannel, clearShowChannel} from 'actions/show';
import View from './view';
const mapStateToProps = ({ show }) => {
return {
2018-02-08 08:02:57 +01:00
// request
2018-02-08 05:15:44 +01:00
requestId : show.request.id,
2018-02-08 06:30:32 +01:00
requestType : show.request.type,
2018-02-08 05:15:44 +01:00
requestChannelName: show.request.data.name,
requestChannelId : show.request.data.id,
2018-02-08 06:30:32 +01:00
requestList : show.channelRequests,
channelList : show.channelList,
2018-02-08 08:02:57 +01:00
// show channel
2018-02-08 05:15:44 +01:00
error : show.showChannel.error,
name : show.showChannel.channelData.name,
shortId : show.showChannel.channelData.shortId,
longId : show.showChannel.channelData.longId,
};
};
2018-02-03 03:16:18 +01:00
const mapDispatchToProps = dispatch => {
return {
2018-02-08 07:22:17 +01:00
onNewChannelRequest (id, name, channelId) {
dispatch(newChannelRequest(id, name, channelId));
},
onRequestError: (error) => {
dispatch(updateRequestError(error, null, null));
},
onShowNewChannel: (id, name, longId) => {
dispatch(showNewChannel(id, name, longId));
},
onShowExistingChannel: () => {
2018-02-08 07:22:17 +01:00
},
onShowChannelClear: () => {
dispatch(clearShowChannel());
},
2018-02-03 03:16:18 +01:00
};
};
export default connect(mapStateToProps, mapDispatchToProps)(View);