Skip to content
Snippets Groups Projects
Verified Commit 1b78ef31 authored by Eliot Berriot's avatar Eliot Berriot
Browse files

Fixed #398: favorited status of tracks not appearing in interface

parent 8974881f
Branches
Tags 0.2.1
No related merge requests found
Fixed favorited status of tracks not appearing in interface (#398)
...@@ -57,13 +57,19 @@ export default { ...@@ -57,13 +57,19 @@ export default {
// will fetch favorites by batches from API to have them locally // will fetch favorites by batches from API to have them locally
let params = { let params = {
user: rootState.auth.profile.id, user: rootState.auth.profile.id,
page_size: 50 page_size: 50,
ordering: '-creation_date'
} }
url = url || 'favorites/tracks/' let promise
return axios.get(url, {params: params}).then((response) => { if (url) {
promise = axios.get(url)
} else {
promise = axios.get('favorites/tracks/', {params: params})
}
return promise.then((response) => {
logger.default.info('Fetched a batch of ' + response.data.results.length + ' favorites') logger.default.info('Fetched a batch of ' + response.data.results.length + ' favorites')
response.data.results.forEach(result => { response.data.results.forEach(result => {
commit('track', {id: result.track, value: true}) commit('track', {id: result.track.id, value: true})
}) })
if (response.data.next) { if (response.data.next) {
dispatch('fetch', response.data.next) dispatch('fetch', response.data.next)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment