1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/web/ synced 2025-03-09 00:00:01 +01:00

check for existing current user upon app mount

This commit is contained in:
Sonja Happ 2020-03-20 11:19:26 +01:00
parent e44c7da7e3
commit 82874b2222

View file

@ -66,10 +66,11 @@ class App extends React.Component {
componentDidMount() {
NotificationsDataManager.setSystem(this.refs.notificationSystem);
// if token stored locally, request user
let token = localStorage.getItem("token");
let currentUser = JSON.parse(localStorage.getItem("currentUser"));
if (token != null && token !== '') {
if (token != null && token !== '' && currentUser != null) {
AppDispatcher.dispatch({
type: 'users/logged-in',
token: token,