fix: contact form sends to API, remove dead links, secure .env

- Contact form now POSTs to /rpc/contact (www-api → n8n webhook)
- Footer links: Mon compte → store.targo.ca, placeholder # → /support
- .env added to .gitignore (Supabase keys should not be committed)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
louispaulb 2026-03-27 15:28:06 -04:00
parent 88dc3714a1
commit 0af24643ff
3 changed files with 24 additions and 17 deletions

1
.gitignore vendored
View File

@ -22,3 +22,4 @@ dist-ssr
*.njsproj *.njsproj
*.sln *.sln
*.sw? *.sw?
.env

View File

@ -31,8 +31,8 @@ La fiabilité, la performance et l'expertise à proximité pour propulser vos co
<ul className="space-y-3 text-sm text-white/60"> <ul className="space-y-3 text-sm text-white/60">
<li><a href="#apropos" className="hover:text-targo-green transition-colors">À propos</a></li> <li><a href="#apropos" className="hover:text-targo-green transition-colors">À propos</a></li>
<li><a href="#contact" className="hover:text-targo-green transition-colors">Contact</a></li> <li><a href="#contact" className="hover:text-targo-green transition-colors">Contact</a></li>
<li><a href="#" className="hover:text-targo-green transition-colors">Mon compte</a></li> <li><a href="https://store.targo.ca/clients" className="hover:text-targo-green transition-colors">Mon compte</a></li>
<li><a href="#" className="hover:text-targo-green transition-colors">Politique de confidentialité</a></li> <li><a href="/support" className="hover:text-targo-green transition-colors">Politique de confidentialité</a></li>
</ul> </ul>
</div> </div>
@ -79,8 +79,8 @@ La fiabilité, la performance et l'expertise à proximité pour propulser vos co
© {new Date().getFullYear()} TARGO Communications. Tous droits réservés. © {new Date().getFullYear()} TARGO Communications. Tous droits réservés.
</p> </p>
<div className="flex items-center gap-8 text-xs font-semibold uppercase tracking-wider text-white/40"> <div className="flex items-center gap-8 text-xs font-semibold uppercase tracking-wider text-white/40">
<a href="#" className="hover:text-targo-green transition-all">Plan d'accessibilité</a> <a href="/support" className="hover:text-targo-green transition-all">Plan d'accessibilité</a>
<a href="#" className="hover:text-targo-green transition-all">Conditions d'utilisation</a> <a href="/support" className="hover:text-targo-green transition-all">Conditions d'utilisation</a>
</div> </div>
</div> </div>
</div> </div>

View File

@ -42,20 +42,26 @@ const Contact = () => {
message: "", message: "",
}); });
const handleSubmit = (e: React.FormEvent) => { const [sending, setSending] = useState(false);
const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault(); e.preventDefault();
setSending(true);
try {
await fetch('/rpc/contact', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(formData),
});
toast({ toast({
title: "Message envoyé!", title: "Message envoyé!",
description: "Nous vous répondrons dans les plus brefs délais.", description: "Nous vous répondrons dans les plus brefs délais.",
}); });
setFormData({ setFormData({ name: "", address: "", postalCode: "", email: "", phone: "", message: "" });
name: "", } catch {
address: "", toast({ title: "Erreur", description: "Impossible d'envoyer. Réessayez ou appelez-nous.", variant: "destructive" });
postalCode: "", }
email: "", setSending(false);
phone: "",
message: "",
});
}; };
const handleChange = (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => { const handleChange = (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {