fix error for deployment on vercel
This commit is contained in:
@@ -1,16 +1,16 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useState } from "react";
|
import {useState} from "react";
|
||||||
|
|
||||||
export default function Contact() {
|
export default function Contact() {
|
||||||
const [form, setForm] = useState({ name: "", email: "", message: "" });
|
const [form, setForm] = useState({name: "", email: "", message: ""});
|
||||||
const [success, setSuccess] = useState(false);
|
const [success, setSuccess] = useState(false);
|
||||||
const [error, setError] = useState("");
|
const [error, setError] = useState("");
|
||||||
|
|
||||||
const handleChange = (
|
const handleChange = (
|
||||||
e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>,
|
e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>,
|
||||||
) => {
|
) => {
|
||||||
setForm({ ...form, [e.target.name]: e.target.value });
|
setForm({...form, [e.target.name]: e.target.value});
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSubmit = async (e: React.FormEvent) => {
|
const handleSubmit = async (e: React.FormEvent) => {
|
||||||
@@ -20,10 +20,14 @@ export default function Contact() {
|
|||||||
// Simulate a successful submission
|
// Simulate a successful submission
|
||||||
await new Promise((resolve) => setTimeout(resolve, 1000));
|
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||||
setSuccess(true);
|
setSuccess(true);
|
||||||
setForm({ name: "", email: "", message: "" });
|
setForm({name: "", email: "", message: ""});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
//use err to avoid unused variable warning
|
||||||
|
if (err instanceof Error) {
|
||||||
setError("Failed to send message. Please try again.");
|
setError("Failed to send message. Please try again.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ export default function NotFound() {
|
|||||||
404
|
404
|
||||||
</h1>
|
</h1>
|
||||||
<p className="mt-4 text-xl text-gray-600 dark:text-gray-300">
|
<p className="mt-4 text-xl text-gray-600 dark:text-gray-300">
|
||||||
Oops! The page you're looking for doesn't exist.
|
Oops! The page you're looking for doesn't exist.
|
||||||
</p>
|
</p>
|
||||||
<Link
|
<Link
|
||||||
href="/"
|
href="/"
|
||||||
|
|||||||
Reference in New Issue
Block a user