fix(contact): route contact form submission directly to backend API (http://127.0.0.1:4001/api/contact)
Deploy Canina / deploy (push) Failing after 28s
Deploy Canina / deploy (push) Failing after 28s
This commit is contained in:
1 parent
00e0d61d96
commit
b329abcf0e
1 file changed
+4
-6
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user