fix: errors tab displaying

This commit is contained in:
Roberto Tonino
2020-09-19 15:11:06 +02:00
parent 5fc41db230
commit 6e195827aa
8 changed files with 73 additions and 37 deletions

View File

@@ -9,6 +9,7 @@ import charts from '@/store/modules/charts'
import favorites from '@/store/modules/favorites'
import about from '@/store/modules/about'
import login from '@/store/modules/login'
import errors from '@/store/modules/errors'
// Load Vuex
Vue.use(Vuex)
@@ -23,7 +24,8 @@ export default new Vuex.Store({
charts,
favorites,
about,
login
login,
errors
},
strict: process.env.NODE_ENV !== 'production'
})

View File

@@ -0,0 +1,45 @@
const state = {
artist: '',
bitrate: '',
cover: '',
downloaded: 0,
errors: [],
failed: 0,
id: '',
progress: 0,
silent: true,
size: 0,
title: '',
type: '',
uuid: ''
}
const actions = {
setErrors({ commit }, payload) {
commit('SET_ERRORS', payload)
}
}
const getters = {
getErrors: state => state
}
const mutations = {
SET_ERRORS(state, payload) {
// The payload has useless data for the GUI, so only the needed data is saved in the store
for (const errorName in state) {
if (state.hasOwnProperty(errorName)) {
const error = payload[errorName]
state[errorName] = error
}
}
}
}
export default {
state,
getters,
actions,
mutations
}

View File

@@ -4,7 +4,8 @@ const state = {
albums: [],
artists: [],
playlists: [],
tracks: []
tracks: [],
test: ''
}
const actions = {
@@ -21,7 +22,7 @@ const actions = {
commit('SET_FAVORITES_ARTISTS', { index, data: artist })
})
dispatch('setFavoritesTracks', payload.tracks)
// dispatch('setFavoritesTracks', payload.tracks)
},
setFavoritesTracks({ commit }, payload) {
payload.forEach((track, index) => {