mirror of
https://github.com/bitwarden/browser
synced 2025-12-20 18:23:31 +00:00
userid null check
This commit is contained in:
@@ -35,6 +35,10 @@ export class SyncService implements SyncServiceAbstraction {
|
|||||||
|
|
||||||
async getLastSync(): Promise<Date> {
|
async getLastSync(): Promise<Date> {
|
||||||
const userId = await this.userService.getUserId();
|
const userId = await this.userService.getUserId();
|
||||||
|
if (userId == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
const lastSync = await this.storageService.get<any>(Keys.lastSyncPrefix + userId);
|
const lastSync = await this.storageService.get<any>(Keys.lastSyncPrefix + userId);
|
||||||
if (lastSync) {
|
if (lastSync) {
|
||||||
return new Date(lastSync);
|
return new Date(lastSync);
|
||||||
@@ -45,6 +49,10 @@ export class SyncService implements SyncServiceAbstraction {
|
|||||||
|
|
||||||
async setLastSync(date: Date): Promise<any> {
|
async setLastSync(date: Date): Promise<any> {
|
||||||
const userId = await this.userService.getUserId();
|
const userId = await this.userService.getUserId();
|
||||||
|
if (userId == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
await this.storageService.save(Keys.lastSyncPrefix + userId, date.toJSON());
|
await this.storageService.save(Keys.lastSyncPrefix + userId, date.toJSON());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user