diff --git a/frontend/application/components/ContactFormClient.tsx b/frontend/application/components/ContactFormClient.tsx index f7126582..b5422403 100644 --- a/frontend/application/components/ContactFormClient.tsx +++ b/frontend/application/components/ContactFormClient.tsx @@ -2,7 +2,7 @@ import { useEffect, useState } from "react"; import { Mail, Phone, MapPin, Send, CheckCircle2 } from "lucide-react"; -import axios from "axios"; +import api from "../lib/services/api"; interface ContactInfoItem { key: string; @@ -21,19 +21,17 @@ export default function ContactFormClient() { const [success, setSuccess] = useState(false); const [error, setError] = useState(""); - const API_URL = process.env.NEXT_PUBLIC_API_URL || ""; - useEffect(() => { async function fetchContactInfo() { try { - const res = await axios.get(`${API_URL}/contact/info`); + const res = await api.get("/contact/info"); setInfoItems(res.data || []); } catch (err) { console.error("Failed to fetch contact info", err); } } fetchContactInfo(); - }, [API_URL]); + }, []); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); @@ -45,7 +43,7 @@ export default function ContactFormClient() { setLoading(true); try { - await axios.post(`${API_URL}/contact`, { + await api.post("/contact", { name, phone, subject,