Allows to read and write "Player properties" from LocalStorage

This commit is contained in:
Benedicte Quimbert 2021-10-15 17:01:38 +02:00
parent 68431c5242
commit e025c1dc8e
5 changed files with 59 additions and 2 deletions

View file

@ -22,8 +22,8 @@ const nonce = "nonce";
const notification = "notificationPermission";
const code = "code";
const cameraSetup = "cameraSetup";
const cacheAPIIndex = "workavdenture-cache";
const userProperties = "user-properties";
class LocalUserStore {
saveUser(localUser: LocalUser) {
@ -220,6 +220,13 @@ class LocalUserStore {
const cameraSetupValues = localStorage.getItem(cameraSetup);
return cameraSetupValues != undefined ? JSON.parse(cameraSetupValues) : undefined;
}
getUserProperty(name: string): string | null {
return localStorage.getItem(userProperties + "_" + name);
}
setUserProperty(name: string, value: string): void {
localStorage.setItem(userProperties + "_" + name, value);
}
}
export const localUserStore = new LocalUserStore();