working scans 🎉
This commit is contained in:
		@@ -19,6 +19,7 @@
 | 
			
		||||
  }, 1000);
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<div class="min-h-screen">
 | 
			
		||||
<div class="bg-white shadow p-2">
 | 
			
		||||
  <div class="flex flex-wrap -mx-1 overflow-hidden">
 | 
			
		||||
    <div class="my-1 px-1 w-1/3 overflow-hidden text-center self-center">
 | 
			
		||||
@@ -36,7 +37,6 @@
 | 
			
		||||
  </div>
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
<div class="p-5 min-h-screen">
 | 
			
		||||
  <h1 class="mr-6 text-7xl font-semibold text-center text-gray-900">
 | 
			
		||||
    {hours}:{minutes}:{seconds}
 | 
			
		||||
  </h1>
 | 
			
		||||
@@ -65,17 +65,17 @@
 | 
			
		||||
                method: "POST",
 | 
			
		||||
                url: "https://dev.lauf-fuer-kaya.de/api/scans/trackscans",
 | 
			
		||||
                headers: { Authorization: "Bearer " + $apikey },
 | 
			
		||||
                data: { card, station: JSON.parse($stationinfo).id },
 | 
			
		||||
                data: { card },
 | 
			
		||||
              })
 | 
			
		||||
              .then((response) => {
 | 
			
		||||
                console.log(response.data.runner);
 | 
			
		||||
                lastscan_totaldistance = response.data.runner.distance + "m";
 | 
			
		||||
                const time = new Date();
 | 
			
		||||
                const hours = (time.getHours() + "").padStart(2, "0");
 | 
			
		||||
                const minutes = (time.getMinutes() + "").padStart(2, "0");
 | 
			
		||||
                const seconds = (time.getSeconds() + "").padStart(2, "0");
 | 
			
		||||
                lastscan_time = hours + ":" + minutes + ":" + seconds;
 | 
			
		||||
                lastscan_laptime = response.data.lapTime + "s";
 | 
			
		||||
                response.data.lapTime = Math.floor(response.data.lapTime / 60) + 'min ' + (Math.floor(response.data.lapTime % 60) + "").padStart(2, "0") + "s"
 | 
			
		||||
                lastscan_laptime = response.data.lapTime;
 | 
			
		||||
                lastscan_totaldistance = Math.floor(response.data.runner.distance / 1000) + 'km ' + (Math.floor(response.data.runner.distance % 1000) + "").padStart(3, "0") + "m"
 | 
			
		||||
              })
 | 
			
		||||
              .catch((e) => {
 | 
			
		||||
                lastscan_error = e.response.data.message;
 | 
			
		||||
@@ -101,15 +101,14 @@
 | 
			
		||||
          <h1 class="text-3xl font-bold text-center">last scan</h1>
 | 
			
		||||
          <h1 class="text-5xl font-bold text-center">{lastscan_time}</h1>
 | 
			
		||||
          <h1 class="text-3xl font-bold text-center">total distance</h1>
 | 
			
		||||
          <h1 class="text-9xl font-bold text-center">
 | 
			
		||||
          <h1 class="text-8xl font-bold text-center">
 | 
			
		||||
            {lastscan_totaldistance}
 | 
			
		||||
          </h1>
 | 
			
		||||
          <h1 class="text-3xl font-bold text-center">lap time</h1>
 | 
			
		||||
          <h1 class="text-9xl font-bold text-center">{lastscan_laptime}</h1>
 | 
			
		||||
          <h1 class="text-8xl font-bold text-center">{lastscan_laptime}</h1>
 | 
			
		||||
        {:else}
 | 
			
		||||
          <h1 class="text-3xl font-bold text-center">please scan a card...</h1>
 | 
			
		||||
        {/if}
 | 
			
		||||
        <!-- <button type="submit" class="w-full py-3 bg-black text-white focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-black">Scan!</button> -->
 | 
			
		||||
        <button type="submit" class="hidden">Scan!</button>
 | 
			
		||||
      </form>
 | 
			
		||||
    </div>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user