Compare commits

...

2 commits

Author SHA1 Message Date
grégoire parant f770876de5
Update EnvironmentVariable.ts 2020-11-22 12:37:00 +01:00
Gregoire Parant 06221e6301 Fix admin console in public room 2020-11-17 18:49:45 +01:00
2 changed files with 42 additions and 31 deletions

View file

@ -31,7 +31,12 @@ class ConnectionManager {
const room = new Room(window.location.pathname + window.location.hash);
return Promise.resolve(room);
} else if (connexionType === GameConnexionTypes.anonymous || connexionType === GameConnexionTypes.empty) {
} else {
//if connexion anonymous, remove local token
if(connexionType !== GameConnexionTypes.organization) {
localUserStore.removeUser();
}
if (connexionType === GameConnexionTypes.anonymous || connexionType === GameConnexionTypes.empty) {
const localUser = localUserStore.getLocalUser();
if (localUser && localUser.jwtToken && localUser.uuid && localUser.textures) {
@ -68,6 +73,7 @@ class ConnectionManager {
return Promise.reject('Could not find a user in localstorage');
}
}
}
return Promise.reject('Invalid URL');
}

View file

@ -6,6 +6,11 @@ class LocalUserStore {
saveUser(localUser: LocalUser) {
localStorage.setItem('localUser', JSON.stringify(localUser));
}
removeUser() {
localStorage.removeItem('localUser');
}
getLocalUser(): LocalUser|null {
const data = localStorage.getItem('localUser');
return data ? JSON.parse(data) : null;