Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const INITIAL_STATE = {
- fetching : false,
- fetched : false,
- ipfsHash : [],
- error : null
- }
- export default (state=INITIAL_STATE,action) =>{
- switch(action.type){
- case 'FILE_UPLOAD_START':
- return {
- ...state,
- fetching:true
- }
- case 'FILE_UPLOAD_SUCCESS':
- return {
- ...state,
- fetching : false,
- fetched : true,
- ipfsHash : action.payload // IPFS is replaced rather than pushing into the array
- }
- case 'FILE_UPLOAD_ERROR':
- return {
- ...state,
- fetching : false,
- fetched : false,
- error : action.payload
- }
- default:
- return {...state}
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement