feat: update social media links in Footer component to use environment variables and refactor Contact component to utilize backend URL from environment variable

This commit is contained in:
2025-06-09 12:21:20 -03:00
parent 6316a59170
commit d57afe93a3
2 changed files with 9 additions and 5 deletions

View File

@@ -8,6 +8,7 @@ export default function Contact() {
const t = useTranslations('contact');
const [formData, setFormData] = useState<{ name: string; email: string; message: string }>({ name: '', email: '', message: '' });
const [isSubmitting, setIsSubmitting] = useState(false);
const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:3001';
const handleChange = (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {
setFormData({...formData, [e.target.name]: e.target.value });
@@ -29,9 +30,8 @@ export default function Contact() {
}
const submissionPromise = async () => {
//const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL;
try {
const response = await fetch(`http://localhost:3001/api/email/send`, {
const response = await fetch(`${backendUrl}/api/email/send`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(formData),