aboutsummaryrefslogtreecommitdiff
path: root/modern/src/MainToolbar.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-09-20 17:56:56 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2020-09-20 17:56:56 -0700
commitb2cd88bbbad82654057cec8aec7415a8caca667e (patch)
treec9d8485cdd5f2e4fd7558b963d095027c3913e86 /modern/src/MainToolbar.js
parentfc990dcc50650862c4f12a1a530b98bbd36ea4b8 (diff)
downloadtrackermap-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.js13
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 (