fix: errors tab displaying
This commit is contained in:
@@ -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'
|
||||
})
|
||||
|
||||
45
src/store/modules/errors.js
Normal file
45
src/store/modules/errors.js
Normal 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
|
||||
}
|
||||
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user