[mobile] fix bug 59920

This commit is contained in:
Maxim Kadushkin 2022-11-30 11:14:16 +03:00
parent d8e3a7be30
commit 5b587c1c13

View file

@ -9,6 +9,7 @@ class LocalStorage {
this._store = {}; this._store = {};
this._prefix = 'mobile-'; this._prefix = 'mobile-';
this._common_keys = ['guest-id', 'guest-username'];
try { try {
this._isAllowed = !!window.localStorage; this._isAllowed = !!window.localStorage;
@ -52,7 +53,9 @@ class LocalStorage {
} }
setItem(name, value, just) { setItem(name, value, just) {
name = this._prefix + name; if ( !this._common_keys.includes(value) )
name = this._prefix + name;
if ( this._isAllowed ) { if ( this._isAllowed ) {
try { try {
localStorage.setItem(name, value); localStorage.setItem(name, value);
@ -67,7 +70,9 @@ class LocalStorage {
} }
getItem(name) { getItem(name) {
name = this._prefix + name; if ( !this._common_keys.includes(name) )
name = this._prefix + name;
if ( this._isAllowed ) if ( this._isAllowed )
return localStorage.getItem(name); return localStorage.getItem(name);
else return this._store[name]===undefined ? null : this._store[name]; else return this._store[name]===undefined ? null : this._store[name];