Added taskStarted and finished events

This commit is contained in:
Joel Collins 2019-11-21 17:01:13 +00:00
parent a9588e0d28
commit 1e9303ee90

View file

@ -130,6 +130,7 @@ export default {
this.taskId = response.data.id; this.taskId = response.data.id;
// Start the store polling TaskId for success // Start the store polling TaskId for success
this.taskRunning = true; this.taskRunning = true;
this.$emit("taskStarted", this.taskId);
// Return the poll-task promise (starts polling the task) // Return the poll-task promise (starts polling the task)
return this.pollTask( return this.pollTask(
this.taskId, this.taskId,
@ -141,6 +142,7 @@ export default {
// Do something with the final response // Do something with the final response
console.log("Emitting onResponse: ", response); console.log("Emitting onResponse: ", response);
this.$emit("response", response); this.$emit("response", response);
this.$emit("finished");
}) })
.catch(error => { .catch(error => {
if (!error) { if (!error) {
@ -148,6 +150,7 @@ export default {
} }
console.log("Emitting onError: ", error); console.log("Emitting onError: ", error);
this.$emit("error", error); this.$emit("error", error);
this.$emit("finished");
}) })
.finally(() => { .finally(() => {
console.log("Cleaning up after task."); console.log("Cleaning up after task.");