Guest User

Untitled

a guest
Dec 17th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. onDrop(file) {
  2. const reader = new FileReader();
  3. reader.onload = () =>{
  4. const fileAsArrayBuffer = reader.result;
  5. this.props.uploadFile(fileAsArrayBuffer);
  6. };
  7. reader.readAsArrayBuffer(file[0]);
  8. }
  9.  
  10. export const uploadFile = file => async dispatch => {
  11. const res = await axios.post('api/upload_file', file);
  12. dispatch({type: FETCH_OVERVIEW, payload: res.data.overview})
  13. };
Add Comment
Please, Sign In to add comment