Use region for author queries

This commit is contained in:
lukeIam 2023-04-16 13:36:50 +02:00
parent 2ae3ea346f
commit a3e63e03d2

View File

@ -9,7 +9,8 @@ class Audnexus {
authorASINsRequest(name) {
name = encodeURIComponent(name);
return axios.get(`${this.baseUrl}/authors?name=${name}`).then((res) => {
var regionQuery = region ? `&region=${region}` : ''
return axios.get(`${this.baseUrl}/authors?name=${name}${regionQuery}`).then((res) => {
return res.data || []
}).catch((error) => {
Logger.error(`[Audnexus] Author ASIN request failed for ${name}`, error)
@ -19,7 +20,8 @@ class Audnexus {
authorRequest(asin) {
asin = encodeURIComponent(asin);
return axios.get(`${this.baseUrl}/authors/${asin}`).then((res) => {
var regionQuery = region ? `?region=${region}` : ''
return axios.get(`${this.baseUrl}/authors/${asin}${regionQuery}`).then((res) => {
return res.data
}).catch((error) => {
Logger.error(`[Audnexus] Author request failed for ${asin}`, error)