diff options
Diffstat (limited to 'modern/src/MainToolbar.js')
-rw-r--r-- | modern/src/MainToolbar.js | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/modern/src/MainToolbar.js b/modern/src/MainToolbar.js index 5994a388..e627f52c 100644 --- a/modern/src/MainToolbar.js +++ b/modern/src/MainToolbar.js @@ -46,13 +46,12 @@ const MainToolbar = () => { const openDrawer = () => { setDrawer(true) } const closeDrawer = () => { setDrawer(false) } - const handleLogout = () => { - fetch('/api/session', { method: 'DELETE' }).then(response => { - if (response.ok) { - dispatch(sessionActions.authenticated(false)); - history.push('/login'); - } - }) + const handleLogout = async () => { + const response = await fetch('/api/session', { method: 'DELETE' }); + if (response.ok) { + dispatch(sessionActions.updateUser(null)); + history.push('/login'); + } } return ( |