aboutsummaryrefslogtreecommitdiff
path: root/modern/src/MainToolbar.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-06-06 15:38:59 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2020-06-06 15:38:59 -0700
commitf8643e6bd88c20cc13383a86f457d909cdd6ae6e (patch)
tree8a9ec30921684d822a4346907617d9bb94c12f80 /modern/src/MainToolbar.js
parentcc03e41dd7f9f401797f39eb08e7d4617d624a2f (diff)
downloadtrackermap-web-f8643e6bd88c20cc13383a86f457d909cdd6ae6e.tar.gz
trackermap-web-f8643e6bd88c20cc13383a86f457d909cdd6ae6e.tar.bz2
trackermap-web-f8643e6bd88c20cc13383a86f457d909cdd6ae6e.zip
Use proper session state
Diffstat (limited to 'modern/src/MainToolbar.js')
-rw-r--r--modern/src/MainToolbar.js5
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');
}
})