fix: use relative URL for API calls instead of localhost
This commit is contained in:
parent
8762f28b27
commit
f8e9443ef8
@ -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>`;
|
||||
|
Loading…
x
Reference in New Issue
Block a user