From e36063ff7a0bee513c6c95937329c6c9de67654e Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 13 Aug 2019 17:35:10 -0400 Subject: [PATCH] handle JSON objects in storage service for safari --- src/services/browserStorage.service.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/services/browserStorage.service.ts b/src/services/browserStorage.service.ts index 40aba6067a..c09d3c5cf3 100644 --- a/src/services/browserStorage.service.ts +++ b/src/services/browserStorage.service.ts @@ -19,7 +19,7 @@ export default class BrowserStorageService implements StorageService { async get(key: string): Promise { if (this.isSafari) { const obj = await SafariApp.sendMessageToApp('storage_get', key); - return obj as T; + return JSON.parse(obj) as T; } else { return new Promise((resolve) => { this.chromeStorageApi.get(key, (obj: any) => { @@ -38,7 +38,7 @@ export default class BrowserStorageService implements StorageService { if (this.isSafari) { await SafariApp.sendMessageToApp('storage_save', { key: key, - obj: obj, + obj: JSON.stringify(obj), }); } else { return new Promise((resolve) => {