I have used a reducer which stores the ipfs hashes as an array. I can't push array of values rather than that the existing hash is overwritten by the new hashes. The Reducer code is
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}
}
}
Any Idea for pushing the hashes into the array ????