309 invalid video #362

Merged
bones7242 merged 2 commits from 309-invalid-video into master 2018-02-26 02:50:34 +01:00
3 changed files with 9 additions and 13 deletions
Showing only changes of commit d4fabe3473 - Show all commits

View file

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

View file

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

View file

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