I need help with my code involving two functions in the mutations and two pieces of 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 function is used to update the files state, while UPLOAD_IMAGE triggers the image uploading process to the server. The issue I'm facing involves updating the uploadProgress state based on the progress received during the upload process using an Observable from uploadImage()
. However, I keep encountering errors as shown in the image below:
https://i.stack.imgur.com/Zp90a.png
I've spent over 4 hours trying to resolve this error without success. Any help or suggestions would be greatly appreciated. Thank you.