diff options
Diffstat (limited to 'modern/src/MainToolbar.js')
-rw-r--r-- | modern/src/MainToolbar.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/modern/src/MainToolbar.js b/modern/src/MainToolbar.js index 038ab30a..2368a82d 100644 --- a/modern/src/MainToolbar.js +++ b/modern/src/MainToolbar.js @@ -1,6 +1,8 @@ import React, { useState } from 'react'; import { useHistory } from 'react-router-dom'; import { makeStyles } from '@material-ui/core/styles'; +import { useDispatch } from 'react-redux'; +import { sessionActions } from './store'; import AppBar from '@material-ui/core/AppBar'; import Toolbar from '@material-ui/core/Toolbar'; import Typography from '@material-ui/core/Typography'; @@ -36,6 +38,7 @@ const useStyles = makeStyles(theme => ({ })); const MainToolbar = () => { + const dispatch = useDispatch(); const [drawer, setDrawer] = useState(false); const classes = useStyles(); const history = useHistory(); @@ -46,7 +49,7 @@ const MainToolbar = () => { const handleLogout = () => { fetch('/api/session', { method: 'DELETE' }).then(response => { if (response.ok) { - document.authenticated = false; + dispatch(sessionActions.authenticated(false)); history.push('/login'); } }) |