added context provider for user profile
This commit was merged in pull request #11.
This commit is contained in:
@@ -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 (
|
||||
<>
|
||||
|
||||
Reference in New Issue
Block a user