Skip to content

Commit

Permalink
feat: Simple routing for log out button
Browse files Browse the repository at this point in the history
  • Loading branch information
firwer committed Feb 9, 2023
1 parent e19ada7 commit 179281d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 9 additions & 1 deletion components/UserBar/UserBar.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import { Fab } from "@mui/material";
import styles from "./UserBar.module.css";
import Image from "next/image";
import { useRouter } from "next/router";

const UserBar = (props: { isAssessor: boolean }) => {
const router = useRouter();
const handleLogout = () => {
router.push("/");
};

return (
<div className={styles.description}>
<div>
Expand All @@ -17,7 +23,9 @@ const UserBar = (props: { isAssessor: boolean }) => {
<Fab sx={{ margin: "0 20px" }} variant="extended">
MY PROFILE
</Fab>
<Fab variant="extended">LOG OUT</Fab>
<Fab variant="extended" onClick={handleLogout}>
LOG OUT
</Fab>
</div>
</div>
);
Expand Down
2 changes: 0 additions & 2 deletions src/pages/assessor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import Image from "next/image";
import Head from "next/head";
import DataGridDemo from "../../../components/table/demo";
import styles from "./assessor.module.css";
import { fontWeight } from "@mui/system";
import { Fab } from "@mui/material";
import UserBar from "components/UserBar/UserBar";

function Home() {
Expand Down

0 comments on commit 179281d

Please sign in to comment.