I'm using the Last.fm API to get data for a user, but by the time I'm done getting all the data I need, I end up making a lot of http requests, which can easily get pretty messy.
What I'm doing at the moment is this ( example for only two requests ):
getData(user) {
return this.$q.all({
userInfo: this.$http.get(this.rootUrl + '?method=user.getinfo&user=' + user + '&api_key=' + this.apiKey + '&format=json'),
userTopArtists: this.$http.get(this.rootUrl + '?method=user.gettoptracks&user=' + user + '&api_key=' + this.apiKey + '&format=json')
}).then(resp => {
return resp;
}).catch(err => {
this.$q.reject('Error' + err.status);
})
}
Is there a more cleaner and efficient way of making multiple http requests when we have such a messy URL ?