2018-02-02 03:42:03 +01:00
|
|
|
import { connect } from 'react-redux';
|
2018-02-08 20:22:19 +01:00
|
|
|
import {newChannelRequest, updateRequestError, showNewChannel, updateShowChannel, clearShowChannel} from 'actions/show';
|
2018-02-02 03:42:03 +01:00
|
|
|
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,
|
2018-02-08 19:59:49 +01:00
|
|
|
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-02 03:42:03 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
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));
|
2018-02-08 19:59:49 +01:00
|
|
|
},
|
2018-02-08 23:01:45 +01:00
|
|
|
onShowNewChannel: (channelData) => {
|
|
|
|
dispatch(showNewChannel(channelData));
|
2018-02-08 19:59:49 +01:00
|
|
|
},
|
2018-02-08 22:22:54 +01:00
|
|
|
onShowExistingChannel: (error, name, shortId, longId, claimsData) => {
|
|
|
|
dispatch(updateShowChannel(error, name, shortId, longId, claimsData));
|
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);
|