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

44 lines
1.4 KiB
JavaScript
Raw Normal View History

import { connect } from 'react-redux';
2018-02-08 07:22:17 +01:00
import {newChannelRequest, updateRequestError, 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,
channels : show.channels,
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));
},
onShowChannelClear: () => {
dispatch(clearShowChannel());
},
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
// },
2018-02-03 03:16:18 +01:00
};
};
export default connect(mapStateToProps, mapDispatchToProps)(View);