@@ -1,11 +1,12 @@
|
||||
<script>
|
||||
import { apikey, lang, stationinfo, api_endpoint } from "./store.js";
|
||||
import { apikey, lang, stationinfo, api_endpoint, laptime_track } from "./store.js";
|
||||
import isURL from "validator/lib/isURL";
|
||||
import isUUID from "validator/lib/isUUID";
|
||||
import axios from "axios";
|
||||
import { _, locale } from "svelte-i18n";
|
||||
let token;
|
||||
let api_endpoint_input = "";
|
||||
let track;
|
||||
$: error = false;
|
||||
$: errormessage = "";
|
||||
$: isTokenValid =
|
||||
@@ -61,12 +62,11 @@
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
{#if $api_endpoint}
|
||||
{#if $api_endpoint && !$apikey}
|
||||
<form
|
||||
class="flex flex-col pt-3 md:pt-8"
|
||||
onsubmit="event.preventDefault();"
|
||||
on:submit={() => {
|
||||
// return
|
||||
axios
|
||||
.request({
|
||||
method: "GET",
|
||||
@@ -113,6 +113,37 @@
|
||||
>{$_("configure")}</button
|
||||
>
|
||||
</form>
|
||||
{:else if $api_endpoint && $apikey}
|
||||
<form
|
||||
class="flex flex-col pt-3 md:pt-8"
|
||||
onsubmit="event.preventDefault();"
|
||||
on:submit={() => {
|
||||
laptime_track.set(track);
|
||||
}}
|
||||
>
|
||||
<div class="flex flex-col pt-4">
|
||||
<label for="track" class="text-lg">Track ID</label>
|
||||
<input
|
||||
type="number"
|
||||
id="track"
|
||||
placeholder="Track"
|
||||
bind:value={track}
|
||||
class:border-red-500={!isTokenValid}
|
||||
class:border-solid={!isTokenValid}
|
||||
class:border-3={!isTokenValid}
|
||||
class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 mt-1 leading-tight focus:outline-none focus:shadow-outline"
|
||||
/>
|
||||
</div>
|
||||
<button
|
||||
disabled={!track}
|
||||
class:cursor-pointer={track}
|
||||
class:opacity-50={!track}
|
||||
id="configure"
|
||||
type="submit"
|
||||
class="bg-black text-white font-bold text-lg hover:bg-gray-700 p-2 mt-8 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-black"
|
||||
>{$_("configure")}</button
|
||||
>
|
||||
</form>
|
||||
{:else}
|
||||
<form
|
||||
class="flex flex-col pt-3 md:pt-8"
|
||||
|
||||
Reference in New Issue
Block a user