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

userid null check

This commit is contained in:
Kyle Spearrin 2018-02-15 13:39:23 -05:00
parent 4412708ecb
commit 7b3bbd9245

View File

@ -35,6 +35,10 @@ export class SyncService implements SyncServiceAbstraction {
async getLastSync(): Promise<Date> {
const userId = await this.userService.getUserId();
if (userId == null) {
return null;
}
const lastSync = await this.storageService.get<any>(Keys.lastSyncPrefix + userId);
if (lastSync) {
return new Date(lastSync);
@ -45,6 +49,10 @@ export class SyncService implements SyncServiceAbstraction {
async setLastSync(date: Date): Promise<any> {
const userId = await this.userService.getUserId();
if (userId == null) {
return;
}
await this.storageService.save(Keys.lastSyncPrefix + userId, date.toJSON());
}