diff options
-rw-r--r-- | modern/src/components/BottomMenu.js | 27 | ||||
-rw-r--r-- | modern/src/settings/OptionsLayout.js | 2 |
2 files changed, 14 insertions, 15 deletions
diff --git a/modern/src/components/BottomMenu.js b/modern/src/components/BottomMenu.js index 920622ae..ff68a2ef 100644 --- a/modern/src/components/BottomMenu.js +++ b/modern/src/components/BottomMenu.js @@ -39,6 +39,18 @@ const BottomMenu = () => { return null; }; + const handleAccount = () => { + setAnchorEl(null); + history.push(`/user/${userId}`); + }; + + const handleLogout = async () => { + setAnchorEl(null); + await fetch('/api/session', { method: 'DELETE' }); + history.push('/login'); + dispatch(sessionActions.updateUser(null)); + }; + const handleSelection = (event, value) => { switch (value) { case 0: @@ -62,18 +74,6 @@ const BottomMenu = () => { } }; - const handleAccount = () => { - setAnchorEl(null); - history.push(`/user/${userId}`); - }; - - const handleLogout = async () => { - setAnchorEl(null); - await fetch('/api/session', { method: 'DELETE' }); - history.push('/login'); - dispatch(sessionActions.updateUser(null)); - }; - return ( <Paper square elevation={3}> <BottomNavigation value={currentSelection()} onChange={handleSelection} showLabels> @@ -82,8 +82,7 @@ const BottomMenu = () => { <BottomNavigationAction label={t('settingsTitle')} icon={<SettingsIcon />} /> {readonly ? (<BottomNavigationAction label={t('loginLogout')} icon={<ExitToAppIcon />} />) - : (<BottomNavigationAction label={t('settingsUser')} icon={<PersonIcon />} />) - } + : (<BottomNavigationAction label={t('settingsUser')} icon={<PersonIcon />} />)} </BottomNavigation> <Menu anchorEl={anchorEl} keepMounted open={Boolean(anchorEl)} onClose={() => setAnchorEl(null)}> <MenuItem onClick={handleAccount}> diff --git a/modern/src/settings/OptionsLayout.js b/modern/src/settings/OptionsLayout.js index 3a78929b..6aab5e37 100644 --- a/modern/src/settings/OptionsLayout.js +++ b/modern/src/settings/OptionsLayout.js @@ -99,7 +99,7 @@ const OptionsLayout = ({ children }) => { ], [t]); const routes = useMemo(() => ( - [ ...readonlyRoutes, ...(!readonly ? mainRoutes : []), ...(admin ? adminRoutes : [])] + [...readonlyRoutes, ...(!readonly ? mainRoutes : []), ...(admin ? adminRoutes : [])] ), [readonlyRoutes, readonly, mainRoutes, admin, adminRoutes]); useEffect(() => { |