added context provider for user profile

This commit was merged in pull request #11.
This commit is contained in:
2023-10-23 04:24:38 -07:00
parent de57daf98a
commit 5502bcd1ae
9 changed files with 157 additions and 69 deletions
+9 -3
View File
@@ -1,4 +1,4 @@
import { useRouter } from 'next/router'
import { useRouter } from "next/router";
import { Typography } from "@mui/material";
import { Box } from "@mui/system";
import Button from "@mui/material/Button";
@@ -6,10 +6,16 @@ import LogoutIcon from "@mui/icons-material/Logout";
import { deleteCookie } from "cookies-next";
export default function Logout() {
const router = useRouter()
const router = useRouter();
const handleLogout = () => {
// Remove the cookie
deleteCookie("cmc-token");
router.push("/auth/login")
// Use replaceState to replace the current URL with the root URL
window.history.replaceState({}, document.title, window.location.href);
// Redirect to the login page
router.push("/auth/login");
};
return (
<>