Fixed Logging In Issue

This commit was merged in pull request #9.
This commit is contained in:
2023-10-22 07:08:04 -07:00
parent eceb3178fd
commit 5e3e17e7c2
7 changed files with 38 additions and 59 deletions
+7 -7
View File
@@ -1,6 +1,6 @@
import React, { useState } from "react";
import { useRouter } from "next/router";
// import { cookies } from "next/headers";
import { setCookie } from 'cookies-next';
import Link from "next/link";
import Grid from "@mui/material/Grid";
import LoadingButton from "@mui/lab/LoadingButton";
@@ -79,18 +79,18 @@ const SignInForm = () => {
}
// Store the token in cookies
// const cookieStore = cookies();
// cookieStore.set("cmc-profile", { ...res.profile }, { secure: true });
// cookieStore.set("cmc-token", res.token, { secure: true });
document.cookie = "cmc-token=" + res.token;
await setCookie("cmc-token", res.token);
router.push("/");
// setLoading(false);
router.push("/");
console.log(res);
} catch (error) {
setLoading(false);
console.log(error);
} finally {
setTimeout(() => {
setLoading(false);
}, 5000);
}
};
+1 -1
View File
@@ -34,7 +34,7 @@ const Layout = ({ children }) => {
}, [router.pathname]);
// Debugging: Log the value of isAuthenticationPage
console.log("isAuthenticationPage:", isAuthenticationPage, router.pathname);
// console.log("isAuthenticationPage:", isAuthenticationPage, router.pathname);
const title = isAuthenticationPage ? "CMC - auth" : "CMC - dashboard";
const mainWrapper = {