1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-24 12:06:15 +01:00

always read before writing

This commit is contained in:
Kyle Spearrin 2018-06-04 12:05:43 -04:00
parent 9b3fddbd33
commit 22c12cf5c4

View File

@ -30,7 +30,7 @@ export class LowdbStorageService implements StorageService {
init() { init() {
if (this.defaults != null) { if (this.defaults != null) {
this.db.defaults(this.defaults).write(); this.db.read().defaults(this.defaults).write();
} }
} }
@ -43,12 +43,12 @@ export class LowdbStorageService implements StorageService {
} }
save(key: string, obj: any): Promise<any> { save(key: string, obj: any): Promise<any> {
this.db.set(key, obj).write(); this.db.read().set(key, obj).write();
return Promise.resolve(); return Promise.resolve();
} }
remove(key: string): Promise<any> { remove(key: string): Promise<any> {
this.db.unset(key).write(); this.db.read().unset(key).write();
return Promise.resolve(); return Promise.resolve();
} }
} }