build: v1.5.2; fix: spotify favorites playlist not showing in Favorites page until the refresh button is clicked (closes #21); refactor: favorites logic

This commit is contained in:
Roberto Tonino
2020-11-28 22:11:11 +01:00
parent 835b0e9f8d
commit d752efa30f
7 changed files with 172 additions and 169 deletions

View File

@@ -1,22 +0,0 @@
import { socket } from '@/utils/socket'
let favoritesData = {}
let cached = false
export function getFavoritesData() {
if (cached) {
return favoritesData
} else {
socket.emit('get_favorites_data')
return new Promise((resolve, reject) => {
socket.on('init_favorites', data => {
favoritesData = data
cached = true
socket.off('init_favorites')
resolve(data)
})
})
}
}