0👍
Instead of abandoning, you could stop the ‘unmount CTA’ being clickable in the first place – until the doSomething() method has been completed its fetch.
export default {
data() {
return {
isFetching: false,
}
},
methods: {
async doSomething() {
this.isFetching = true
let data = await someApiCall()
},
myUnmount() {
// Do your unmount
},
},
async mounted(){
await this.doSomething()
this.isFetching = false
}
}
And then bind this to the CTA;
<button @click="myUnmount()" :disabled="isFetching">Unmount</button>
Source:stackexchange.com