about summary refs log tree commit diff
path: root/app/assets/javascripts/components/containers/upload_form_container.jsx
blob: b168e81879955e4584a0374d455953b97a1ce8f7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { connect }                          from 'react-redux';
import UploadForm                           from '../components/upload_form';
import { uploadCompose, undoUploadCompose } from '../actions/compose';

const mapStateToProps = function (state, props) {
  return {
    media: state.getIn(['compose', 'media_attachments']),
    progress: state.getIn(['compose', 'progress']),
    is_uploading: state.getIn(['compose', 'is_uploading'])
  };
};

const mapDispatchToProps = function (dispatch) {
  return {
    onSelectFile: function (files) {
      dispatch(uploadCompose(files));
    },

    onRemoveFile: function (media_id) {
      dispatch(undoUploadCompose(media_id));
    }
  }
};

export default connect(mapStateToProps, mapDispatchToProps)(UploadForm);