diff --git a/client/components/app/Appbar.vue b/client/components/app/Appbar.vue index fe1af849..eeab3ce4 100644 --- a/client/components/app/Appbar.vue +++ b/client/components/app/Appbar.vue @@ -122,7 +122,7 @@ export default { return this.$store.state.globals.selectedMediaItems }, selectedMediaItemsArePlayable() { - return !this.selectedMediaItems.some(i => !i.hasTracks) + return !this.selectedMediaItems.some((i) => !i.hasTracks) }, userMediaProgress() { return this.$store.state.user.user.mediaProgress || [] @@ -164,12 +164,15 @@ export default { this.$store.commit('setProcessingBatch', true) const libraryItemIds = this.selectedMediaItems.map((i) => i.id) - const libraryItems = await this.$axios.$post(`/api/items/batch/get`, { libraryItemIds }).catch((error) => { - const errorMsg = error.response.data || 'Failed to get items' - console.error(errorMsg, error) - this.$toast.error(errorMsg) - return [] - }) + const libraryItems = await this.$axios + .$post(`/api/items/batch/get`, { libraryItemIds }) + .then((res) => res.libraryItems) + .catch((error) => { + const errorMsg = error.response.data || 'Failed to get items' + console.error(errorMsg, error) + this.$toast.error(errorMsg) + return [] + }) if (!libraryItems.length) { this.$store.commit('setProcessingBatch', false) diff --git a/client/components/modals/AccountModal.vue b/client/components/modals/AccountModal.vue index 6ea989cb..82045d51 100644 --- a/client/components/modals/AccountModal.vue +++ b/client/components/modals/AccountModal.vue @@ -201,8 +201,8 @@ export default { this.loadingTags = true this.$axios .$get(`/api/tags`) - .then((tags) => { - this.tags = tags + .then((res) => { + this.tags = res.tags this.loadingTags = false }) .catch((error) => { diff --git a/client/components/modals/item/tabs/Cover.vue b/client/components/modals/item/tabs/Cover.vue index 529a06e5..5b866b07 100644 --- a/client/components/modals/item/tabs/Cover.vue +++ b/client/components/modals/item/tabs/Cover.vue @@ -303,11 +303,14 @@ export default { this.persistProvider() this.isProcessing = true - var searchQuery = this.getSearchQuery() - var results = await this.$axios.$get(`/api/search/covers?${searchQuery}`).catch((error) => { - console.error('Failed', error) - return [] - }) + const searchQuery = this.getSearchQuery() + const results = await this.$axios + .$get(`/api/search/covers?${searchQuery}`) + .then((res) => res.results) + .catch((error) => { + console.error('Failed', error) + return [] + }) this.coversFound = results this.isProcessing = false this.hasSearched = true diff --git a/client/components/modals/item/tabs/Match.vue b/client/components/modals/item/tabs/Match.vue index 7af136bd..79e0fe11 100644 --- a/client/components/modals/item/tabs/Match.vue +++ b/client/components/modals/item/tabs/Match.vue @@ -306,13 +306,13 @@ export default { this.runSearch() }, async runSearch() { - var searchQuery = this.getSearchQuery() + const searchQuery = this.getSearchQuery() if (this.lastSearch === searchQuery) return this.searchResults = [] this.isProcessing = true this.lastSearch = searchQuery - var searchEntity = this.isPodcast ? 'podcast' : 'books' - var results = await this.$axios.$get(`/api/search/${searchEntity}?${searchQuery}`, { timeout: 20000 }).catch((error) => { + const searchEntity = this.isPodcast ? 'podcast' : 'books' + let results = await this.$axios.$get(`/api/search/${searchEntity}?${searchQuery}`, { timeout: 20000 }).catch((error) => { console.error('Failed', error) return [] }) diff --git a/client/components/tables/UsersTable.vue b/client/components/tables/UsersTable.vue index d243fe31..a3b99ae8 100644 --- a/client/components/tables/UsersTable.vue +++ b/client/components/tables/UsersTable.vue @@ -109,8 +109,8 @@ export default { loadUsers() { this.$axios .$get('/api/users') - .then((users) => { - this.users = users.sort((a, b) => { + .then((res) => { + this.users = res.users.sort((a, b) => { return a.createdAt - b.createdAt }) }) diff --git a/client/components/tables/library/LibrariesTable.vue b/client/components/tables/library/LibrariesTable.vue index 90e4cf1a..9f8360cb 100644 --- a/client/components/tables/library/LibrariesTable.vue +++ b/client/components/tables/library/LibrariesTable.vue @@ -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) } }) } diff --git a/client/pages/batch/index.vue b/client/pages/batch/index.vue index 976005eb..fd5f6d89 100644 --- a/client/pages/batch/index.vue +++ b/client/pages/batch/index.vue @@ -96,11 +96,14 @@ export default { } const libraryItemIds = store.state.globals.selectedMediaItems.map((i) => i.id) - const libraryItems = await app.$axios.$post(`/api/items/batch/get`, { libraryItemIds }).catch((error) => { - const errorMsg = error.response.data || 'Failed to get items' - console.error(errorMsg, error) - return [] - }) + const libraryItems = await app.$axios + .$post(`/api/items/batch/get`, { libraryItemIds }) + .then((res) => res.libraryItems) + .catch((error) => { + const errorMsg = error.response.data || 'Failed to get items' + console.error(errorMsg, error) + return [] + }) return { mediaType: libraryItems[0].mediaType, libraryItems diff --git a/client/pages/config/sessions.vue b/client/pages/config/sessions.vue index 2e417ce5..a3213c81 100644 --- a/client/pages/config/sessions.vue +++ b/client/pages/config/sessions.vue @@ -61,10 +61,10 @@