I have a dialog component, which executes two async functions on submit. My goal is to keep the dialog opened and show a loading state until both functions are finished. After it, I want to close the dialog.
My submit function, which is defined in parent component, looks like this:
async submit() {
await this.foo1();
await this.foo2();
}
This function is passed as a prop to the dialog component:
<app-dialog @submit="submit" />
In my dialog component, on a button click, I try to do this:
async onClick() {
await this.$emit('submit');
this.closeDialog();
},
However, dialog is closed immediately instead of waiting for submit to be executed. What's the best way to accomplish this?