diff --git a/src/services/sync.service.ts b/src/services/sync.service.ts index f233803c3e..2a001e01a8 100644 --- a/src/services/sync.service.ts +++ b/src/services/sync.service.ts @@ -35,6 +35,10 @@ export class SyncService implements SyncServiceAbstraction { async getLastSync(): Promise { const userId = await this.userService.getUserId(); + if (userId == null) { + return null; + } + const lastSync = await this.storageService.get(Keys.lastSyncPrefix + userId); if (lastSync) { return new Date(lastSync); @@ -45,6 +49,10 @@ export class SyncService implements SyncServiceAbstraction { async setLastSync(date: Date): Promise { const userId = await this.userService.getUserId(); + if (userId == null) { + return; + } + await this.storageService.save(Keys.lastSyncPrefix + userId, date.toJSON()); }