From f756b4da32785be5a891c97252347ea4bfa14c78 Mon Sep 17 00:00:00 2001 From: yash Date: Wed, 14 Feb 2024 18:12:03 +0530 Subject: [PATCH] feat: logout --- src/features/workspace-view/index.tsx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/features/workspace-view/index.tsx b/src/features/workspace-view/index.tsx index ef279d6..26d3f08 100644 --- a/src/features/workspace-view/index.tsx +++ b/src/features/workspace-view/index.tsx @@ -8,6 +8,7 @@ import { UserOrgDetails, getUserOrgs } from 'app/api/user'; import loader from '../../app/assets/gifs/loader.gif'; import { Navigate, useNavigate } from 'react-router-dom'; import { useSelector } from 'react-redux'; +import toast from 'react-hot-toast'; const WorkspaceView = () => { const userContext = useContext(UserContext); @@ -41,15 +42,28 @@ const WorkspaceView = () => { searchValue, ]); + const LogoutHandler= async()=>{ + try{ + localStorage.removeItem('token') + toast.success('Logout successful!'); + navigate("/login") + }catch(e){ + + } + } return (
+ +