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

43 lines
1.4 KiB
JavaScript
Raw Normal View History

import { connect } from 'react-redux';
2018-02-08 06:30:32 +01:00
import {newChannelRequest, updateRequestError} from 'actions/show';
import View from './view';
const mapStateToProps = ({ show }) => {
return {
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,
channels : show.channels,
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 06:30:32 +01:00
// onShowChannelError: (error) => {
// dispatch(updateShowChannelError(error));
// },
// onChannelDataUpdate: (name, longId, shortId) => {
// dispatch(updateChannelData(name, longId, shortId));
// dispatch(updateShowChannelError(null)); // clear any errors
// },
// onChannelDataClear: () => {
// dispatch(updateChannelData(null, null, null));
// },
// new
onNewChannelRequest (id, name, channelId) {
dispatch(newChannelRequest(id, name, channelId));
},
2018-02-08 06:30:32 +01:00
onRequestError: (error) => {
dispatch(updateRequestError(error, null, null));
2018-02-03 03:16:18 +01:00
},
};
};
export default connect(mapStateToProps, mapDispatchToProps)(View);