React/Redux - publish component #323

Merged
bones7242 merged 80 commits from react-upload into master 2018-01-25 22:43:20 +01:00
2 changed files with 4 additions and 2 deletions
Showing only changes of commit 6d37843c09 - Show all commits

View file

@ -1,5 +1,5 @@
import {connect} from 'react-redux';
import {setPublishInChannel, updateSelectedChannel} from 'actions/publish';
import {setPublishInChannel, updateSelectedChannel, updateError} from 'actions/publish';
import View from './view.jsx';
const mapStateToProps = ({ channel, publish }) => {
@ -14,9 +14,11 @@ const mapStateToProps = ({ channel, publish }) => {
const mapDispatchToProps = dispatch => {
return {
onPublishInChannelChange: (value) => {
dispatch(updateError('channel', null));
dispatch(setPublishInChannel(value));
},
onChannelSelect: (value) => {
dispatch(updateError('channel', null));
dispatch(updateSelectedChannel(value));
},
};

View file

@ -21,7 +21,7 @@ class PublishForm extends React.Component {
// if publishInChannel is true, is a channel selected & logged in?
if (this.props.publishInChannel && (this.props.selectedChannel !== this.props.loggedInChannel.name)) {
// update state with error
this.props.onChannelSelectionError('Select "Anonymous" or log in to a channel');
this.props.onChannelSelectionError('Select a channel or Anonymous');
// reject this promise
return reject(new Error('Fix the channel'));
}