Fix:User accessible libraries #84

This commit is contained in:
advplyr
2022-01-16 14:14:02 -06:00
parent a2031f1d88
commit c07b527a1d
7 changed files with 48 additions and 54 deletions
+1 -1
View File
@@ -18,7 +18,7 @@ export const getters = {
console.error('No book item id', bookItem)
}
if (process.env.NODE_ENV !== 'production') { // Testing
return `http://localhost:3333/api/books/${bookItem.id}/cover?token=${userToken}&ts=${bookLastUpdate}`
// return `http://localhost:3333/api/books/${bookItem.id}/cover?token=${userToken}&ts=${bookLastUpdate}`
}
var url = new URL(`/api/books/${bookItem.id}/cover`, rootState.serverUrl)
+9 -3
View File
@@ -2,7 +2,7 @@ export const state = () => ({
libraries: [],
lastLoad: 0,
listeners: [],
currentLibraryId: 'main',
currentLibraryId: '',
showModal: false,
folders: [],
folderLastUpdate: 0,
@@ -65,17 +65,23 @@ export const actions = {
return false
}
this.$axios
return this.$axios
.$get(`/api/libraries`)
.then((data) => {
// Set current library
if (data.length) {
commit('setCurrentLibrary', data[0].id)
}
commit('set', data)
commit('setLastLoad')
return true
})
.catch((error) => {
console.error('Failed', error)
commit('set', [])
return false
})
return true
},
}