I have two functions in my mutations and two state
const state = {
files: [],
uploadProgress: 0
}
const mutations = {
SET_UPLOAD_IMAGE: (state, files) => {
state.files = files
},
UPLOAD_IMAGE: (state) => {
StandbyService.uploadImage(state.files).subscribe(progress => {
state.uploadProgress += progress
console.log(`Upload Progress ${progress}%`)
})
}
}
SET_UPLOAD_IMAGE is used to set the files state and UPLOAD_IMAGE is used to trigger uploading the image to the server. The upload process run and return the upload progress. My uploadImage()
return an Observable and I want to update the uploadProgress state whenever the progress is received, but I can't do such that. It keep on giving error in the console as shown in the picture below:
I don't know what to do with this error. I already spent more than 4 hours with this. I really appreciate for helps and suggestions. Thank you very much.