diff --git a/Client/src/Components/NavBar/index.jsx b/Client/src/Components/NavBar/index.jsx index 08eb91580..2756f7ffd 100644 --- a/Client/src/Components/NavBar/index.jsx +++ b/Client/src/Components/NavBar/index.jsx @@ -21,6 +21,8 @@ import UserSvg from "../../assets/icons/user.svg?react"; import TeamSvg from "../../assets/icons/user-two.svg?react"; import LogoutSvg from "../../assets/icons/logout.svg?react"; import { Stack, useScrollTrigger } from "@mui/material"; +import axiosIntance from "../../Utils/axiosConfig"; +import axios from "axios"; const icons = { Profile: , @@ -93,10 +95,20 @@ function NavBar() { * Handles logging out the user * */ - const logout = () => { + const logout = async () => { // Clear auth state dispatch(clearAuthState()); dispatch(clearUptimeMonitorState()); + await axiosIntance.post( + "/auth/logout", + {}, + { + headers: { + Authorization: `Bearer ${authState.authToken}`, + "Content-Type": "application/json", + }, + } + ); navigate("/login"); };