diff --git a/server/controllers/bookData/Inventaire.js b/server/controllers/bookData/Inventaire.js index 63c4819..cd84aba 100644 --- a/server/controllers/bookData/Inventaire.js +++ b/server/controllers/bookData/Inventaire.js @@ -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) { diff --git a/server/controllers/search/Inventaire.js b/server/controllers/search/Inventaire.js index ac6b2a1..e39afce 100644 --- a/server/controllers/search/Inventaire.js +++ b/server/controllers/search/Inventaire.js @@ -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 {