Clean up ApiRouter adding MiscController, move upload and scan to api endpoints

This commit is contained in:
advplyr 2022-03-18 11:51:55 -05:00
parent 69fcb103e4
commit 57399bb79e
14 changed files with 299 additions and 270 deletions

View file

@ -117,22 +117,28 @@ export default {
this.quickMatching = false
})
},
libraryScanComplete(result) {
this.rescanning = false
if (!result) {
this.$toast.error(`Re-Scan Failed for "${this.title}"`)
} else if (result === 'UPDATED') {
this.$toast.success(`Re-Scan complete item was updated`)
} else if (result === 'UPTODATE') {
this.$toast.success(`Re-Scan complete item was up to date`)
} else if (result === 'REMOVED') {
this.$toast.error(`Re-Scan complete item was removed`)
}
},
rescan() {
this.rescanning = true
this.$root.socket.once('item_scan_complete', this.libraryScanComplete)
this.$root.socket.emit('scan_item', this.libraryItemId)
this.$axios
.$get(`/api/items/${this.libraryItemId}/scan`)
.then((data) => {
this.rescanning = false
var result = data.result
if (!result) {
this.$toast.error(`Re-Scan Failed for "${this.title}"`)
} else if (result === 'UPDATED') {
this.$toast.success(`Re-Scan complete item was updated`)
} else if (result === 'UPTODATE') {
this.$toast.success(`Re-Scan complete item was up to date`)
} else if (result === 'REMOVED') {
this.$toast.error(`Re-Scan complete item was removed`)
}
})
.catch((error) => {
console.error('Failed to scan library item', error)
this.$toast.error('Failed to scan library item')
this.rescanning = false
})
},
saveMetadataComplete(result) {
this.savingMetadata = false