Fix:Re-Scan item using context menu on library page #948

This commit is contained in:
advplyr 2022-08-28 15:04:45 -05:00
parent 3cafa87eda
commit ac57b2b867

View File

@ -137,7 +137,6 @@ export default {
processing: false, processing: false,
libraryItem: null, libraryItem: null,
imageReady: false, imageReady: false,
rescanning: false,
selected: false, selected: false,
isSelectionMode: false, isSelectionMode: false,
showCoverBg: false showCoverBg: false
@ -555,11 +554,12 @@ export default {
this.$emit('editPodcast', this.libraryItem) this.$emit('editPodcast', this.libraryItem)
}, },
rescan() { rescan() {
this.rescanning = true if (this.processing) return
this.$axios const axios = this.$axios || this.$nuxt.$axios
this.processing = true
axios
.$get(`/api/items/${this.libraryItemId}/scan`) .$get(`/api/items/${this.libraryItemId}/scan`)
.then((data) => { .then((data) => {
this.rescanning = false
var result = data.result var result = data.result
if (!result) { if (!result) {
this.$toast.error(`Re-Scan Failed for "${this.title}"`) this.$toast.error(`Re-Scan Failed for "${this.title}"`)
@ -570,11 +570,12 @@ export default {
} else if (result === 'REMOVED') { } else if (result === 'REMOVED') {
this.$toast.error(`Re-Scan complete item was removed`) this.$toast.error(`Re-Scan complete item was removed`)
} }
this.processing = false
}) })
.catch((error) => { .catch((error) => {
console.error('Failed to scan library item', error) console.error('Failed to scan library item', error)
this.$toast.error('Failed to scan library item') this.$toast.error('Failed to scan library item')
this.rescanning = false this.processing = false
}) })
}, },
showEditModalFiles() { showEditModalFiles() {