ajout du fichier de route

This commit is contained in:
mrtoine 2025-10-01 14:42:59 +02:00
parent c851865728
commit ef1ba911d9
4 changed files with 125 additions and 27 deletions

View file

@ -19,9 +19,8 @@ export default function ContactComponent() {
useEffect(() => {
if (!onContactPage) return;
// Essaye avec BACKEND_URL, sinon fallback vers une route locale hypothétique
const backend = (process.env.BACKEND_URL as string) || "http://127.0.0.1:5000/api";
const url = backend ? `${backend}/contact` : "http://127.0.0.1:5000/api/contact";
// Appelle l'API interne Next.js qui proxy vers le BACKEND_URL côté serveur
const url = "/api/contact";
fetch(url, { cache: "no-store" })
.then((res) => (res.ok ? res.json() : Promise.reject(new Error("fetch contact failed"))))