2021-10-05 05:11:42 +02:00
|
|
|
export const state = () => ({
|
2022-01-09 00:03:33 +01:00
|
|
|
libraryScans: [],
|
|
|
|
providers: [
|
|
|
|
{
|
|
|
|
text: 'Google Books',
|
|
|
|
value: 'google'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: 'Open Library',
|
|
|
|
value: 'openlibrary'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: 'Audible',
|
|
|
|
value: 'audible'
|
2022-03-07 00:26:35 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
text: 'iTunes',
|
|
|
|
value: 'itunes'
|
2022-01-09 00:03:33 +01:00
|
|
|
}
|
|
|
|
]
|
2021-10-05 05:11:42 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
export const getters = {
|
|
|
|
getLibraryScan: state => id => {
|
|
|
|
return state.libraryScans.find(ls => ls.id === id)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export const actions = {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export const mutations = {
|
|
|
|
addUpdate(state, data) {
|
|
|
|
var index = state.libraryScans.findIndex(lib => lib.id === data.id)
|
|
|
|
if (index >= 0) {
|
|
|
|
state.libraryScans.splice(index, 1, data)
|
|
|
|
} else {
|
|
|
|
state.libraryScans.push(data)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
remove(state, data) {
|
|
|
|
state.libraryScans = state.libraryScans.filter(scan => scan.id !== data.id)
|
|
|
|
}
|
|
|
|
}
|