MCPcopy Create free account
hub / github.com/devs-in-tech/DevsInTech / handleSubmit

Function handleSubmit

src/components/Letter.jsx:17–40  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

15 }
16
17 const handleSubmit = (e) => {
18 e.preventDefault();
19
20
21 if (email === "") {
22 seterror("**E-mail is Required!");
23 } else if (!validEmail(email)) {
24 seterror("**Enter a valid E-mail!");
25 }
26 else {
27 // Make the POST request using Axios
28 axios
29 .post("/api/subscribes", { email })
30 .then((response) => {
31 // Handle the success response here
32 console.log(response.data);
33 setSubscriptionSuccess(true);
34 })
35 .catch((error) => {
36 // Handle the error here
37 console.error(error);
38 });
39 }
40 };
41
42 const handleEmailChange = (e) => {
43 setEmail(e.target.value);

Callers

nothing calls this directly

Calls 1

validEmailFunction · 0.85

Tested by

no test coverage detected