diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2020-09-20 17:56:56 -0700 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2020-09-20 17:56:56 -0700 |
commit | b2cd88bbbad82654057cec8aec7415a8caca667e (patch) | |
tree | c9d8485cdd5f2e4fd7558b963d095027c3913e86 /modern/src/MainToolbar.js | |
parent | fc990dcc50650862c4f12a1a530b98bbd36ea4b8 (diff) | |
download | trackermap-web-b2cd88bbbad82654057cec8aec7415a8caca667e.tar.gz trackermap-web-b2cd88bbbad82654057cec8aec7415a8caca667e.tar.bz2 trackermap-web-b2cd88bbbad82654057cec8aec7415a8caca667e.zip |
Use async functions
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 ( |