I have an image upload function and this upload returns a data when finished, and I have a line below that function to do another task. the problem is vuejs/js does not wait until the first function completes the task. So, this is what my code looks like:
methods : {
uploadImage (file) {
this.uploadModule.upload(file);
if(this.uploadModule.isSuccess) {
this.images.push(this.uploadModule.response)
}
// someFunction()
}
}
So, in the above example since the upload() methods takes some time, then someFunction() part gets run before the this.images.push() part.
Is there away to just wait until the upload is finished before running another function?
this.uploadModule.uploaddoes, and what it offers to execute code after the async operation finishes.