fix: use relative URL for API calls instead of localhost

This commit is contained in:
SansGuidon 2025-05-24 23:58:06 +02:00
parent 8762f28b27
commit f8e9443ef8
2 changed files with 3 additions and 2 deletions

View File

@ -1 +1 @@
0.0.2
0.0.3

View File

@ -49,7 +49,8 @@
filmsDiv.innerHTML = '<p class="loader">Recherche en cours...</p>';
try {
const response = await fetch(`http://localhost:3000/search?q=${encodeURIComponent(query)}`);
const base = window.location.origin;
const response = await fetch(`${base}/search?q=${encodeURIComponent(query)}`);
if (!response.ok) {
// Gilfoyle: "The network, or your server, is garbage."
filmsDiv.innerHTML = `<p class="no-results">Erreur: ${response.status} ${response.statusText || 'Impossible de joindre le backend.'}</p>`;