From ede784a0bb958b29e3757ea2378367d1ced7cc73 Mon Sep 17 00:00:00 2001 From: Cedric Date: Fri, 3 Jul 2026 14:18:51 +0200 Subject: [PATCH] Actualiser js/auth.js --- js/auth.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/js/auth.js b/js/auth.js index 86ba944..223c553 100644 --- a/js/auth.js +++ b/js/auth.js @@ -1,4 +1,13 @@ -const API_BASE_URL = window.location.origin + '/api'; +let API_BASE_URL; + +// Si on est en local (localhost ou IP locale) +if (window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1') { + API_BASE_URL = 'http://localhost/mon-petit-pari/api'; +} +// Si on est en production (sur le vrai nom de domaine) +else { + API_BASE_URL = 'https://monpetitpari.fr/api'; +} // Gestion du token function getToken() {