feat(webui): reAnalyze library

closes #51
This commit is contained in:
Gauthier Roebroeck 2020-01-06 11:18:05 +08:00
parent fa65e94ae6
commit b599b72c48
2 changed files with 28 additions and 0 deletions

View file

@ -41,6 +41,19 @@
</v-list-item>
</v-list>
</v-menu>
<v-menu offset-y v-if="libraryId !== 0">
<template v-slot:activator="{ on }">
<v-btn icon v-on="on">
<v-icon>mdi-dots-vertical</v-icon>
</v-btn>
</template>
<v-list>
<v-list-item @click="analyze()">
<v-list-item-title>Analyze</v-list-item-title>
</v-list-item>
</v-list>
</v-menu>
</v-toolbar>
<v-container fluid class="px-6">
@ -242,6 +255,9 @@ export default Vue.extend({
} else {
return 'All libraries'
}
},
analyze () {
this.$komgaLibraries.analyzeLibrary(this.libraryId)
}
}
})

View file

@ -56,4 +56,16 @@ export default class KomgaLibrariesService {
throw new Error(msg)
}
}
async analyzeLibrary (libraryId: number) {
try {
await this.http.post(`${API_LIBRARIES}/${libraryId}/analyze`)
} catch (e) {
let msg = `An error occurred while trying to analyze library`
if (e.response.data.message) {
msg += `: ${e.response.data.message}`
}
throw new Error(msg)
}
}
}