In vuejs to make a method which I can call from any component?
Just the same method I use in several components and that would not write it for everyone it can as it is placed in a separate file?
And that it is better to use?
.then(res => this.categories = res.data)
.catch(err => console.log('Error'));