diff --git a/components/Layout.jsx b/components/Layout.jsx index 2c3c045..ede6ae7 100644 --- a/components/Layout.jsx +++ b/components/Layout.jsx @@ -14,23 +14,23 @@ const Layout = ({ children }) => { Picture and ToDo Manager - - {isModelLoaded && (
{children} + +
)} - + {!isModelLoaded && (

@@ -42,7 +42,10 @@ const Layout = ({ children }) => {

)} - + ); }; diff --git a/components/sign-up/modal.jsx b/components/sign-up/modal.jsx index 31325fb..a4c7a4d 100644 --- a/components/sign-up/modal.jsx +++ b/components/sign-up/modal.jsx @@ -13,7 +13,7 @@ import { waitToast, updateToast, } from "../../components/toast"; -import { toast } from "react-toastify"; +import {ToastContainer, toast } from "react-toastify"; import { useRouter } from "next/router"; const SignUpModal = ({ username, setUsername, modalIsOpen, setModalsOpen }) => { @@ -75,10 +75,10 @@ const SignUpModal = ({ username, setUsername, modalIsOpen, setModalsOpen }) => { if (res.data.error.face) errorToast(res.data.error.face); else { - setToken(res.data.token); - setModalsOpen(false); - router.push("/"); - sucsessToast("Signed-up"); + setModalsOpen(false); + setToken(res.data.token); + router.push("/"); + sucsessToast("Signed-up"); } }) @@ -96,6 +96,7 @@ const SignUpModal = ({ username, setUsername, modalIsOpen, setModalsOpen }) => { }; return ( +
@@ -193,6 +194,7 @@ const SignUpModal = ({ username, setUsername, modalIsOpen, setModalsOpen }) => {
+ ); }; diff --git a/pages/index.jsx b/pages/index.jsx index 3538dfa..c87a80f 100644 --- a/pages/index.jsx +++ b/pages/index.jsx @@ -2,6 +2,7 @@ import { useEffect, useState } from "react"; import styles from "../styles/Home.module.css"; import { useAuth } from "../context/auth"; import axios from "../utils/axios"; +import {ToastContainer, toast } from "react-toastify"; export default function Home() { const [user, setUser] = useState(""); @@ -10,8 +11,7 @@ export default function Home() { useEffect(() => { - if (token) { - + const getUser = () =>{ axios({ url: "api/auth/profile", method: "GET", @@ -27,14 +27,19 @@ export default function Home() { .catch(function (err) { // console.log(err); }); - + } + + if (token) { + getUser() } }, [token]); + return ( -
-
+
+ +
diff --git a/styles/Home.module.css b/styles/Home.module.css index b115286..b881b00 100644 --- a/styles/Home.module.css +++ b/styles/Home.module.css @@ -1,3 +1,4 @@ .main{ - height: 84vh; + /* height: 84vh; */ + border: 2px solid red; } \ No newline at end of file diff --git a/styles/sign-in/signin.module.css b/styles/sign-in/signin.module.css index fe66b7d..e8d0213 100644 --- a/styles/sign-in/signin.module.css +++ b/styles/sign-in/signin.module.css @@ -1,5 +1,6 @@ .above { height: 84vh; + border: 2px solid red; } .main { background-color: rgba(0, 0, 0, 0.6); diff --git a/styles/signup/modalsignup.module.css b/styles/signup/modalsignup.module.css index eade6c3..33b9ecd 100644 --- a/styles/signup/modalsignup.module.css +++ b/styles/signup/modalsignup.module.css @@ -1,5 +1,6 @@ .modal { background: rgba(0, 0, 0, 0.5); + border: 2px solid red; } .closeButton {