Преглед изворни кода

Locatie ook opvragen in registratiescherm

Harry de Boer пре 6 година
родитељ
комит
c73912c52b
1 измењених фајлова са 6 додато и 1 уклоњено
  1. 6 1
      src/main/resources/static/main.js

+ 6 - 1
src/main/resources/static/main.js

@@ -14,6 +14,7 @@ class Puzzeltocht {
         this.missionScreen = new MissionScreen();
         this.missionScreen.setAnswerListener(e => this.answer(e));
         this.location = new LocationApi();
+        this.location.enable(p => this.updateLocation(p))
         console.log("puzzeltocht initialised");
     }
 
@@ -22,7 +23,7 @@ class Puzzeltocht {
         this.teamId = teamId;
         document.getElementById("join").style.display = "none";
         document.getElementById("mission").style.display = "block";
-        this.location.enable(p => this.updateLocation(p))
+        // this.location.enable(p => this.updateLocation(p))
     }
 
     answer(a) {
@@ -45,6 +46,10 @@ class Puzzeltocht {
         this.position = position;
         l.innerText = position.string();
 
+        if (this.eventId === null || this.eventId === undefined) {
+            return;
+        }
+
         if (this.lastUpdate === undefined || Date.now() - this.lastUpdate > 5000) {
             Api.sendUpdate(this.eventId, this.teamId, position)
                 .then(m => {