diff --git a/src/frontend/src/utilities/CustomDrawer.jsx b/src/frontend/src/utilities/CustomDrawer.jsx index ed11a7279c..b6f4368292 100644 --- a/src/frontend/src/utilities/CustomDrawer.jsx +++ b/src/frontend/src/utilities/CustomDrawer.jsx @@ -3,9 +3,13 @@ import SwipeableDrawer from '@mui/material/SwipeableDrawer'; import CoreModules from '../shared/CoreModules'; import AssetModules from '../shared/AssetModules'; import { NavLink } from 'react-router-dom'; +import { createLoginWindow } from '../utilfunctions/login'; +import { LoginActions } from '../store/slices/LoginSlice'; +import { ProjectActions } from '../store/slices/ProjectSlice'; -export default function CustomDrawer({ open, placement, size, type, onClose, onSignOut }) { +export default function CustomDrawer({ open, placement, size, type, onClose, onSignOut, setOpen }) { const defaultTheme = CoreModules.useAppSelector((state) => state.theme.hotTheme); + const dispatch = CoreModules.useAppDispatch(); const onMouseEnter = (event) => { const element = document.getElementById(`text${event.target.id}`); @@ -81,6 +85,12 @@ export default function CustomDrawer({ open, placement, size, type, onClose, onS }, ]; + const handleOnSignOut = () => { + setOpen(false); + dispatch(LoginActions.signOut(null)); + dispatch(ProjectActions.clearProjects([])); + }; + return (
@@ -144,14 +154,11 @@ export default function CustomDrawer({ open, placement, size, type, onClose, onS ), )} +
+ {token != null ? ( +
+ Sign Out +
+ ) : ( +
createLoginWindow('/')} + > + Sign In +
+ )} +
diff --git a/src/frontend/src/utilities/PrimaryAppBar.tsx b/src/frontend/src/utilities/PrimaryAppBar.tsx index 299a528a00..d40952fd78 100755 --- a/src/frontend/src/utilities/PrimaryAppBar.tsx +++ b/src/frontend/src/utilities/PrimaryAppBar.tsx @@ -66,6 +66,7 @@ export default function PrimaryAppBar() { size={windowSize} type={type} onSignOut={handleOnSignOut} + setOpen={setOpen} />