I need to disable this button before the user click on an radio-button option (option.type and already works) and after he clicks to send the data to the API through "Method" function and if the API returns an error, the button should be available. I tried "onClick" with setTimeOut to disable, but if the API returns an error the button stay disabled. I'm using Vue.js with some corporate libraries.
HTML:
<button :disabled="!option.type" @click="Method" label="continue"/>
__________________________________________________________________________
JS:
async Method() {
await Service.sendPin({ option: option.type, key: method.key, document: document.customer
}).then(data) => {
this.loadingField = false;
this.emit(ACTIONS.SEND_CODE, data);
}.catch(item) => {
this.loadingField = false;
this.emit(ACTIONS.SEND_CODE);
})
}