as in the beforecreate() lifecycle hook the data won't be accessible what is the purpose to make API calls in it (I came accross it in many cases)
here an example:
beforeCreate() {
this.$myService.isEnabled().then(value => {
this.isEnabled = value;
}).finally(() => {
this.$myService.getAll();
});
the service
export function isEnabled() {
return fetch(`url`, {
method: 'GET',
}).then(resp => {
if (!resp) {
throw new Error('blocking error');
} else {
return resp.text();
}
});
}
is it a good or bad practice ?