Skip to content
This repository has been archived by the owner on Jun 17, 2022. It is now read-only.

Commit

Permalink
always read before writing
Browse files Browse the repository at this point in the history
  • Loading branch information
kspearrin committed Jun 4, 2018
1 parent 9b3fddb commit 22c12cf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/services/lowdbStorage.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class LowdbStorageService implements StorageService {

init() {
if (this.defaults != null) {
this.db.defaults(this.defaults).write();
this.db.read().defaults(this.defaults).write();
}
}

Expand All @@ -43,12 +43,12 @@ export class LowdbStorageService implements StorageService {
}

save(key: string, obj: any): Promise<any> {
this.db.set(key, obj).write();
this.db.read().set(key, obj).write();
return Promise.resolve();
}

remove(key: string): Promise<any> {
this.db.unset(key).write();
this.db.read().unset(key).write();
return Promise.resolve();
}
}

0 comments on commit 22c12cf

Please sign in to comment.