Skip to content

Commit

Permalink
Fix Logout
Browse files Browse the repository at this point in the history
  • Loading branch information
Peyton-McKee committed Jan 23, 2025
1 parent f3e9ee7 commit e5fb6f7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/frontend/src/layouts/PageTitle/NavUserMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,14 @@ const NavUserMenu: React.FC<NavUserMenuProps> = ({ open }) => {
};

const ProdLogout = () => (
<MenuItem component="div" sx={{ py: 0 }} onClick={googleLogout}>
<MenuItem
component="div"
sx={{ py: 0 }}
onClick={() => {
googleLogout();
history.push('/');
}}
>
<ListItemIcon>
<LogoutIcon fontSize="small" />
</ListItemIcon>
Expand Down
2 changes: 2 additions & 0 deletions src/frontend/src/pages/LoginPage/LoginDev.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ const LoginDev: React.FC<LoginDevProps> = ({ devSetUser, devFormSubmit }) => {
))}
</Select>
</FormControl>
<label htmlFor="anId">label</label>
<input id="anId" type='date' value="2011-11-22"></input>
</form>
);
};
Expand Down
11 changes: 10 additions & 1 deletion src/frontend/src/pages/SettingsPage/SettingsPreferences.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { useState } from 'react';
import UserSecureSettings from './UserSecureSettings/UserSecureSettings';
import UserScheduleSettings from './UserScheduleSettings/UserScheduleSettings';
import { Box } from '@mui/system';
import { useHistory } from 'react-router-dom';

const NERSwitch = styled((props: SwitchProps) => (
<Switch focusVisibleClassName=".Mui-focusVisible" disableRipple {...props} />
Expand Down Expand Up @@ -62,6 +63,7 @@ const NERSwitch = styled((props: SwitchProps) => (
const SettingsPreferences: React.FC = () => {
const auth = useAuth();
const user = useCurrentUser();
const history = useHistory();
const [showAlert, setShowAlert] = useState(false);
const {
isLoading: settingsIsLoading,
Expand Down Expand Up @@ -129,7 +131,14 @@ const SettingsPreferences: React.FC = () => {
import.meta.env.MODE === 'development' ? (
<NERSwitch id="trick-switch" sx={{ m: 1 }} onClick={logout} />
) : (
<NERSwitch id="trick-switch" sx={{ m: 1 }} onClick={googleLogout} />
<NERSwitch
id="trick-switch"
sx={{ m: 1 }}
onClick={() => {
googleLogout();
history.push('/');
}}
/>
)
}
/>
Expand Down

0 comments on commit e5fb6f7

Please sign in to comment.