Decide on SEARCH_ENDPOINT based on current URL.

This commit is contained in:
Sergio Martínez Portela 2022-10-21 20:17:41 +02:00
parent f66d69776b
commit a18c94dca0

View File

@ -47,7 +47,10 @@ function _codigoparallevar_enable_search_box(selector, options) {
const DEBOUNCE_TIME = 500; // Milliseconds const DEBOUNCE_TIME = 500; // Milliseconds
const MIN_LENGTH = 3; const MIN_LENGTH = 3;
const SEARCH_ENDPOINT = 'https://api.codigoparallevar.com/api/search'; const SEARCH_ENDPOINT = (window.location.host.startsWith('localhost')
? 'http://localhost:3001/api/search'
: 'https://api.codigoparallevar.com/api/search'
);
let debounceWaiter = null; let debounceWaiter = null;
let currentQuery = null; let currentQuery = null;