From 5f1861240cf3afbcc6ae55960f1fe1ebc6e0f91a Mon Sep 17 00:00:00 2001 From: ztimson Date: Mon, 2 Sep 2019 14:12:05 -0400 Subject: [PATCH] Always delete --- src/app/services/sync.service.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app/services/sync.service.ts b/src/app/services/sync.service.ts index 78ef752..9d17acd 100644 --- a/src/app/services/sync.service.ts +++ b/src/app/services/sync.service.ts @@ -135,6 +135,9 @@ export class SyncService { } async unload() { + // Hack to delete doc on page close + navigator.sendBeacon(`https://us-central1-mapalliance-ab38a.cloudfunctions.net/closeSession/?mapCode=${this.mapCode}&username=${this.username}`); + this.save(); if(this.saveInterval) clearInterval(this.saveInterval); @@ -152,7 +155,6 @@ export class SyncService { this.location = null; this.locationChanged = false; this.locationDoc = null; - navigator.sendBeacon(`https://us-central1-mapalliance-ab38a.cloudfunctions.net/closeSession/?mapCode=${this.mapCode}&username=${this.username}`); } this.mapCode = null;