add rst command
This commit is contained in:
		| @@ -27,12 +27,12 @@ | ||||
|       if (e.key === "Escape") { | ||||
|         modal_open = false; | ||||
|       } | ||||
|       if (e.keyCode === 13) { | ||||
|         if (createbtnenabled === true) { | ||||
|           createbtnenabled = false; | ||||
|           submit(); | ||||
|         } | ||||
|       } | ||||
|       // if (e.keyCode === 13) { | ||||
|       //   if (createbtnenabled === true) { | ||||
|       //     createbtnenabled = false; | ||||
|       //     submit(); | ||||
|       //   } | ||||
|       // } | ||||
|       if (command === "" && e.key === "c") { | ||||
|         command = "c"; | ||||
|       } else if (command === "c" && e.key === "n") { | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| <script> | ||||
|   import { apikey, lang, api_endpoint, laptime_track } from "./store.js"; | ||||
|   import { apikey, lang, api_endpoint, laptime_track, clear } from "./store.js"; | ||||
|   import isURL from "validator/lib/isURL"; | ||||
|   import isUUID from "validator/lib/isUUID"; | ||||
|   import axios from "axios"; | ||||
| @@ -10,10 +10,12 @@ | ||||
|   $: error = false; | ||||
|   $: errormessage = ""; | ||||
|   $: isTokenValid = | ||||
|     token?.length === 44 && | ||||
|     token === "rst" || | ||||
|     (token?.length === 44 && | ||||
|       token.split(".")[0].length === 7 && | ||||
|     isUUID(token.split(".")[1]); | ||||
|   $: isEndpointValid = isURL(api_endpoint_input); | ||||
|       isUUID(token.split(".")[1])); | ||||
|   $: isEndpointValid = | ||||
|     api_endpoint_input === "rst" || isURL(api_endpoint_input); | ||||
| </script> | ||||
|  | ||||
| <div class="w-full flex flex-wrap"> | ||||
| @@ -67,6 +69,10 @@ | ||||
|           class="flex flex-col pt-3 md:pt-8" | ||||
|           onsubmit="event.preventDefault();" | ||||
|           on:submit={() => { | ||||
|             if (token === "rst") { | ||||
|               clear(); | ||||
|               return; | ||||
|             } | ||||
|             axios | ||||
|               .request({ | ||||
|                 method: "GET", | ||||
| @@ -117,6 +123,11 @@ | ||||
|           class="flex flex-col pt-3 md:pt-8" | ||||
|           onsubmit="event.preventDefault();" | ||||
|           on:submit={() => { | ||||
|             if (api_endpoint_input === "rst") { | ||||
|               clear(); | ||||
|               api_endpoint_input = ""; | ||||
|               return; | ||||
|             } | ||||
|             if (api_endpoint_input.includes("api/")) { | ||||
|               api_endpoint_input = api_endpoint_input.replace("api/", ""); | ||||
|             } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user