removed unneeded actions from publish form

This commit is contained in:
bill bittner 2018-02-25 17:47:22 -08:00
parent 3a64e2dccf
commit d4fabe3473
3 changed files with 9 additions and 13 deletions

View file

@ -12,14 +12,17 @@ const mapStateToProps = ({ publish }) => {
const mapDispatchToProps = dispatch => {
return {
onFileSelect: (file) => {
selectFile: (file) => {
dispatch(selectFile(file));
dispatch(updateError('publishSubmit', null));
},
onFileError: (value) => {
setFileError: (value) => {
dispatch(clearFile());
dispatch(updateError('file', value));
},
clearFileError: () => {
dispatch(updateError('file', null));
},
};
};

View file

@ -74,11 +74,11 @@ class Dropzone extends React.Component {
try {
validateFile(file); // validate the file's name, type, and size
} catch (error) {
return this.props.onFileError(error.message);
return this.props.setFileError(error.message);
}
// stage it so it will be ready when the publish button is clicked
this.props.onFileError(null);
this.props.onFileSelect(file);
this.props.clearFileError(null);
this.props.selectFile(file);
}
}
render () {

View file

@ -1,6 +1,5 @@
import {connect} from 'react-redux';
import {clearFile, selectFile, updateError, updatePublishStatus} from 'actions/publish';
import {updateLoggedInChannel} from 'actions/channel';
import {clearFile, updateError, updatePublishStatus} from 'actions/publish';
import View from './view';
const mapStateToProps = ({ channel, publish }) => {
@ -23,15 +22,9 @@ const mapStateToProps = ({ channel, publish }) => {
const mapDispatchToProps = dispatch => {
return {
onFileSelect: (file) => {
dispatch(selectFile(file));
},
onFileClear: () => {
dispatch(clearFile());
},
onChannelLogin: (name, shortId, longId) => {
dispatch(updateLoggedInChannel(name, shortId, longId));
},
onPublishStatusChange: (status, message) => {
dispatch(updatePublishStatus(status, message));
},