From a18c94dca0b5a4223eca54048d6706d28c90d952 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Mart=C3=ADnez=20Portela?= Date: Fri, 21 Oct 2022 20:17:41 +0200 Subject: [PATCH] Decide on SEARCH_ENDPOINT based on current URL. --- static/search-box.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/static/search-box.js b/static/search-box.js index 13d9f14..50b11c5 100644 --- a/static/search-box.js +++ b/static/search-box.js @@ -47,7 +47,10 @@ function _codigoparallevar_enable_search_box(selector, options) { const DEBOUNCE_TIME = 500; // Milliseconds 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 currentQuery = null;