2021-09-04 21:17:26 +02:00
|
|
|
|
|
|
|
export const state = () => ({
|
|
|
|
downloads: []
|
|
|
|
})
|
|
|
|
|
|
|
|
export const getters = {
|
2022-04-22 01:52:28 +02:00
|
|
|
getDownloads: (state) => (libraryItemId) => {
|
|
|
|
return state.downloads.filter(d => d.libraryItemId === libraryItemId)
|
2021-09-15 03:45:00 +02:00
|
|
|
},
|
|
|
|
getDownload: (state) => (id) => {
|
|
|
|
return state.downloads.find(d => d.id === id)
|
2021-09-04 21:17:26 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export const actions = {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export const mutations = {
|
2022-04-22 01:52:28 +02:00
|
|
|
setDownloads(state, downloads) {
|
|
|
|
state.downloads = downloads
|
|
|
|
},
|
2021-09-04 21:17:26 +02:00
|
|
|
addUpdateDownload(state, download) {
|
|
|
|
var index = state.downloads.findIndex(d => d.id === download.id)
|
|
|
|
if (index >= 0) {
|
|
|
|
state.downloads.splice(index, 1, download)
|
|
|
|
} else {
|
|
|
|
state.downloads.push(download)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
removeDownload(state, download) {
|
|
|
|
state.downloads = state.downloads.filter(d => d.id !== download.id)
|
|
|
|
}
|
|
|
|
}
|