Update:Matching authors uses the ASIN if set #572, Fix:Purge author image cache when updating author

This commit is contained in:
advplyr 2022-05-13 18:11:54 -05:00
parent eaa383b6d8
commit f78d287b59
7 changed files with 43 additions and 79 deletions

View file

@ -139,12 +139,17 @@ export default {
this.processing = false
},
async searchAuthor() {
if (!this.authorCopy.name) {
if (!this.authorCopy.name && !this.authorCopy.asin) {
this.$toast.error('Must enter an author name')
return
}
this.processing = true
var response = await this.$axios.$post(`/api/authors/${this.authorId}/match`, { q: this.authorCopy.name }).catch((error) => {
const payload = {}
if (this.authorCopy.asin) payload.asin = this.authorCopy.asin
else payload.q = this.authorCopy.name
var response = await this.$axios.$post(`/api/authors/${this.authorId}/match`, payload).catch((error) => {
console.error('Failed', error)
return null
})