Update libraries reorder and get all authors routes

This commit is contained in:
advplyr 2022-12-12 17:33:59 -06:00
parent eede2bbd46
commit 3c0fdff7b4
2 changed files with 10 additions and 7 deletions

View File

@ -82,10 +82,10 @@ export default {
})
var newOrder = libraryOrderData.map((lib) => lib.id).join(',')
if (currOrder !== newOrder) {
this.$axios.$post('/api/libraries/order', libraryOrderData).then((libraries) => {
if (libraries && libraries.length) {
this.$axios.$post('/api/libraries/order', libraryOrderData).then((response) => {
if (response.libraries && response.libraries.length) {
this.$toast.success('Library order saved', { timeout: 1500 })
this.$store.commit('libraries/set', libraries)
this.$store.commit('libraries/set', response.libraries)
}
})
}

View File

@ -48,10 +48,13 @@ export default {
},
methods: {
async init() {
this.authors = await this.$axios.$get(`/api/libraries/${this.currentLibraryId}/authors`).catch((error) => {
console.error('Failed to load authors', error)
return []
})
this.authors = await this.$axios
.$get(`/api/libraries/${this.currentLibraryId}/authors`)
.then((response) => response.authors)
.catch((error) => {
console.error('Failed to load authors', error)
return []
})
this.loading = false
},
authorAdded(author) {