Commit 44ac55b7 authored by Agate's avatar Agate 💬

Fixed #3: background loading of favorites

parent fc04ad54
import logger from '@/logging'
import config from '@/config'
import cache from '@/cache'
// import favoriteTracks from '@/favorites/tracks'
import favoriteTracks from '@/favorites/tracks'
// URL and endpoint constants
const LOGIN_URL = config.API_URL + 'token/'
......@@ -68,6 +68,6 @@ export default {
connect () {
// called once user has logged in successfully / reauthenticated
// e.g. after a page refresh
// favoriteTracks.fetch()
favoriteTracks.fetch()
}
}
......@@ -41,8 +41,8 @@ export default {
resource.get().then((response) => {
logger.default.info('Fetched a batch of ' + response.data.results.length + ' favorites')
Vue.set(self, 'count', response.data.count)
response.data.results.forEach(track => {
Vue.set(self.objects, track.id, true)
response.data.results.forEach(result => {
Vue.set(self.objects, result.track, true)
})
if (response.data.next) {
self.fetch(response.data.next)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment