#Someone HELP ME MY BRAIN IS GOING FzdxfhaETSdfx

6 messages · Page 1 of 1 (latest)

fallen herald
#

AXIOS

#
import axios from 'axios';

const Contact = () => {

  let res = [];

  const handleSubmit = async (e) => {
    e.preventDefault();
    const FormData = new FormData(e.target);
    try {
      const response = await axios.post('api/contactmail', {
        fname:FormData.get('fname'),
        email:FormData.get('email'),
        subject:FormData.get('subject'),
        message:FormData.get('message'),
      });
      console.log(response.data);
      res = response.data;
      // Handle the response
    } catch (error) {
      console.error(error);
      res = response.data;
      // Handle the error
    }
  };


export default Contact
#

WHaT IS CAUSING ERROR

#

i removed the render part cause too many char

bold moss
#

Use Server Action