Fix incorrect use of static Inventaire URL
This commit is contained in:
parent
8f0edf7e01
commit
963049e4c8
|
@ -2,12 +2,11 @@ const fetch = require('node-fetch');
|
|||
|
||||
class Inventaire {
|
||||
constructor(language = 'en') {
|
||||
this.url = 'https://inventaire.io';
|
||||
this.lang = language;
|
||||
}
|
||||
|
||||
static getURL() { // Use a method instead of `get` to avoid collisions with `this.url`
|
||||
return this.url;
|
||||
static get url() {
|
||||
return 'https://inventaire.io';
|
||||
}
|
||||
|
||||
static handleQuickEntity(entityObject) {
|
||||
|
|
|
@ -3,7 +3,7 @@ const fetch = require('node-fetch');
|
|||
const Inventaire = require('../bookData/Inventaire');
|
||||
|
||||
function quickSearchInventaire(searchTerm, language) {
|
||||
const request = fetch(`${Inventaire.getURL()}/api/search?types=works&search=${encodeURIComponent(searchTerm)}&lang=${encodeURIComponent(language)}&limit=10`)
|
||||
const request = fetch(`${Inventaire.url}/api/search?types=works&search=${encodeURIComponent(searchTerm)}&lang=${encodeURIComponent(language)}&limit=10`)
|
||||
request.catch(exception => {
|
||||
console.error(exception);
|
||||
return {
|
||||
|
@ -27,7 +27,7 @@ function quickSearchInventaire(searchTerm, language) {
|
|||
|
||||
function searchInventaire(searchTerm, language) {
|
||||
if (this.hasQuery) {
|
||||
const request = fetch(`${Inventaire.getURL()}/api/entities?action=search&search=${encodeURIComponent(searchTerm)}&lang=${encodeURIComponent(language)}`)
|
||||
const request = fetch(`${Inventaire.url}/api/entities?action=search&search=${encodeURIComponent(searchTerm)}&lang=${encodeURIComponent(language)}`)
|
||||
request.catch(exception => {
|
||||
console.error(exception);
|
||||
return {
|
||||
|
|
Loading…
Reference in New Issue