From 852b4571b34d60845f37956e9468f845d9dd627e Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Fri, 31 Aug 2018 17:22:38 -0400 Subject: [PATCH] check last sync before revision date --- src/services/sync.service.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/services/sync.service.ts b/src/services/sync.service.ts index e440b86784..405322228b 100644 --- a/src/services/sync.service.ts +++ b/src/services/sync.service.ts @@ -216,14 +216,16 @@ export class SyncService implements SyncServiceAbstraction { return [true, false]; } + const lastSync = await this.getLastSync(); + if (lastSync == null || lastSync.getTime() === 0) { + return [true, false]; + } + try { const response = await this.apiService.getAccountRevisionDate(); - const accountRevisionDate = new Date(response); - const lastSync = await this.getLastSync(); - if (lastSync != null && accountRevisionDate <= lastSync) { + if (new Date(response) <= lastSync) { return [false, false]; } - return [true, false]; } catch (e) { return [false, true];