export function getApiUrl() { if (typeof window !== "undefined") { // đŸ”„ DĂ©tection du mode local cĂŽtĂ© client const isLocalhost = window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1" || window.location.hostname.startsWith("192.168.") || window.location.hostname.endsWith(".local"); console.log("🌍 [getApiUrl] Mode CLIENT dĂ©tectĂ© - URL :", isLocalhost ? "http://localhost:1337" : "https://api.fernandgrascalvet.com"); return isLocalhost ? "http://localhost:1337" : "https://api.fernandgrascalvet.com"; } // đŸ”„ CĂŽtĂ© serveur (SSR), on utilise une variable d'environnement const apiUrl = process.env.NEXT_PUBLIC_API_URL || "https://api.fernandgrascalvet.com"; console.log("🌍 [getApiUrl] Mode SERVEUR dĂ©tectĂ© - URL :", apiUrl); return apiUrl; }