Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. const INITIAL_STATE = {
  2. fetching : false,
  3. fetched : false,
  4. ipfsHash : [],
  5. error : null
  6. }
  7. export default (state=INITIAL_STATE,action) =>{
  8. switch(action.type){
  9. case 'FILE_UPLOAD_START':
  10. return {
  11. ...state,
  12. fetching:true
  13. }
  14. case 'FILE_UPLOAD_SUCCESS':
  15. return {
  16. ...state,
  17. fetching : false,
  18. fetched : true,
  19. ipfsHash : action.payload // IPFS is replaced rather than pushing into the array
  20. }
  21. case 'FILE_UPLOAD_ERROR':
  22. return {
  23. ...state,
  24. fetching : false,
  25. fetched : false,
  26. error : action.payload
  27. }
  28. default:
  29. return {...state}
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement