diff --git a/sdk/src/core/Cache.ts b/sdk/src/core/Cache.ts index 70e723f..e970b74 100644 --- a/sdk/src/core/Cache.ts +++ b/sdk/src/core/Cache.ts @@ -23,7 +23,9 @@ export default class Cache { } public async setItem(key, data) { - this.setItemSync(key, data); + await this._externals.localStorage.setItem(this._prefixKey(key), JSON.stringify(data)); + return this; + //this.setItemSync(key, data); } public removeItemSync(key) { @@ -32,7 +34,9 @@ export default class Cache { } public async removeItem(key) { - await this.removeItemSync(key); + await this._externals.localStorage.removeItem(this._prefixKey(key)); + return this; + //await this.removeItemSync(key); } public getItemSync(key) { @@ -42,7 +46,10 @@ export default class Cache { } public async getItem(key) { - return this.getItemSync(key); + const item = await this._externals.localStorage.getItem(this._prefixKey(key)); + if (!item) {return null;} + return JSON.parse(item); + // return this.getItemSync(key); } private async _keys(): Promise {