1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-02 08:40:08 +01:00

handle JSON objects in storage service for safari

This commit is contained in:
Kyle Spearrin 2019-08-13 17:35:10 -04:00
parent 80d0bd68f1
commit e36063ff7a

View File

@ -19,7 +19,7 @@ export default class BrowserStorageService implements StorageService {
async get<T>(key: string): Promise<T> {
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) => {