diff --git a/templates/content.js b/components/templates/content.js similarity index 92% rename from templates/content.js rename to components/templates/content.js index a0e3372..c49e1f9 100644 --- a/templates/content.js +++ b/components/templates/content.js @@ -1,4 +1,4 @@ -import styles from "../styles/Home.module.css"; +import styles from "../../styles/Home.module.css"; export default function Content() { return ( diff --git a/templates/footer.js b/components/templates/footer.js similarity index 100% rename from templates/footer.js rename to components/templates/footer.js diff --git a/templates/generator.js b/components/templates/generator.js similarity index 100% rename from templates/generator.js rename to components/templates/generator.js diff --git a/templates/header.js b/components/templates/header.js similarity index 100% rename from templates/header.js rename to components/templates/header.js diff --git a/templates/nav.js b/components/templates/nav.js similarity index 100% rename from templates/nav.js rename to components/templates/nav.js diff --git a/templates/userTop.js b/components/templates/userTop.js similarity index 100% rename from templates/userTop.js rename to components/templates/userTop.js diff --git a/pages/index.js b/pages/index.js index f3bae7e..9be4f05 100644 --- a/pages/index.js +++ b/pages/index.js @@ -1,10 +1,10 @@ import Head from "next/head"; import styles from "../styles/Home.module.css"; -import Header from "../templates/header"; -import Generator from "../templates/generator"; -import Nav from "../templates/nav"; -import UserTop from "../templates/userTop"; -import Footer from "../templates/footer"; +import Header from "../components/templates/header"; +import Generator from "../components/templates/generator"; +import Nav from "../components/templates/nav"; +import UserTop from "../components/templates/userTop"; +import Footer from "../components/templates/footer"; import { useState } from "react"; import { useSession, signIn, signOut } from "next-auth/react"; import { Button } from "evergreen-ui"; diff --git a/pages/kontakt.js b/pages/kontakt.js index 9a1ff54..e637ea1 100644 --- a/pages/kontakt.js +++ b/pages/kontakt.js @@ -1,9 +1,10 @@ import Head from "next/head"; import styles from "../styles/Home.module.css"; -import Header from "../templates/header"; -import Nav from "../templates/nav"; -import Content from "../templates/content"; -import Footer from "../templates/footer"; +import Header from "../components/templates/header"; +import Nav from "../components/templates/nav"; +import Content from "../components/templates/content"; +import Footer from "../components/templates/footer"; +import axios from "axios"; import { useState } from "react"; @@ -21,14 +22,11 @@ export default function Kontakt() { email, message } - fetch('/api/contact', { - method: 'POST', - headers: { - 'Accept': 'application/json, text/plain, */*', - 'Content-Type': 'application/json' - }, - body: JSON.stringify(data) - }).then((res) => { + axios + .post("/api/contact", { + message: data + }) + .then((res) => { console.log('Response received') if (res.status === 200) { console.log('Response succeeded!') @@ -68,7 +66,6 @@ export default function Kontakt() { -