Fixes Contact Page API route and minor bug fixes

This commit is contained in:
Jyotirmoy Bandyopadhayaya 2022-06-19 17:08:42 +05:30
parent 9901514623
commit 401836381b
3 changed files with 12 additions and 6 deletions

View File

@ -1,5 +1,6 @@
import React from "react"; import React from "react";
import { ContactStyle } from "./contact.style"; import { ContactStyle } from "./contact.style";
import axios from "handlers/axios";
function Contact() { function Contact() {
const [input, setInput] = React.useState({ const [input, setInput] = React.useState({
@ -8,6 +9,7 @@ function Contact() {
message: "", message: "",
topic: "", topic: "",
}); });
const [isSubmitted, setIsSubmitted] = React.useState("Sent");
function changeInput(evt) { function changeInput(evt) {
const { name, value } = evt.target; const { name, value } = evt.target;
setInput({ setInput({
@ -17,7 +19,8 @@ function Contact() {
} }
function submitForm(evt) { function submitForm(evt) {
evt.preventDefault(); evt.preventDefault();
console.log(input); axios.post("/contactme/postQuery", input);
setIsSubmitted("Done");
} }
return ( return (
<ContactStyle> <ContactStyle>
@ -116,7 +119,7 @@ function Contact() {
/> />
</div> </div>
<button type="submit" className="btn btn-primary"> <button type="submit" className="btn btn-primary">
Submit {isSubmitted}
</button> </button>
</form> </form>
</div> </div>

View File

@ -1,8 +1,13 @@
import "../styles/globals.css"; import "../styles/globals.css";
// import { loadCursor } from "../components/providers/cursor"; import CustomCursor from "components/providers/cursor";
function MyPortfolio({ Component, pageProps }) { function MyPortfolio({ Component, pageProps }) {
return <Component {...pageProps} />; return (
<>
<CustomCursor />
<Component {...pageProps} />
</>
)
} }
export default MyPortfolio; export default MyPortfolio;

View File

@ -2,7 +2,6 @@ import Head from "next/head";
import Nav from "components/nav"; import Nav from "components/nav";
import Main from "components/main"; import Main from "components/main";
import BMC from "components/buymeacoffee"; import BMC from "components/buymeacoffee";
import CustomCursor from "components/providers/cursor";
export default function Home() { export default function Home() {
return ( return (
@ -34,7 +33,6 @@ export default function Home() {
rel="stylesheet" rel="stylesheet"
/> />
</Head> </Head>
<CustomCursor />
<Nav /> <Nav />
<Main /> <Main />
<BMC /> <BMC />