Re-enable 'Find by Code'

Backend fixes now mean this feature works again.
This commit is contained in:
Fred Boniface 2024-11-10 19:13:32 +00:00
parent 8a030964a4
commit 1d1e9416ab

View File

@ -2,7 +2,6 @@
import Header from "$lib/navigation/header.svelte";
import Nav from "$lib/navigation/nav.svelte";
import Island from "$lib/islands/island.svelte";
import Loading from "$lib/navigation/loading.svelte";
import { uuid } from "$lib/stores/uuid";
import StylesToc from "$lib/train/styles-toc.svelte";
import { getApiUrl } from "$lib/scripts/upstream";
@ -17,23 +16,17 @@
let data = [];
let error = false;
let errMsg = "Unknown Error";
let isLoading = false;
async function findByStartEnd() {
isLoading = true;
const url = `${getApiUrl()}/api/v2/pis/byStartEnd/${entryStartCRS}/${entryEndCRS}`;
await fetchData(url);
isLoading = false;
}
/* Temporarily Disabled
async function findByPis() {
isLoading = true;
const url = `${getApiUrl()}/api/v2/pis/byCode/${entryPIS}`;
await fetchData(url);
isLoading = false;
}
*/
async function fetchData(url: string) {
const options = {
@ -77,7 +70,6 @@
entryStartCRS = "";
entryEndCRS = "";
toast.success("Form reset");
isLoading = false;
}
onMount(() => {
@ -89,10 +81,6 @@
<Header {title} />
{#if isLoading}
<Loading />
{/if}
{#if error}
<Island {variables}>
<p class="error">{errMsg}</p>
@ -124,14 +112,14 @@
<br />
<button type="submit">Search</button>
</form>
<!-- FIND BY PIS CODE NOT WORKING AT PRESENT
<p class="label">Find By PIS Code:</p>
<form on:submit={findByPis}>
<input type="number" max="9999" autocomplete="off" placeholder="PIS" bind:value={entryPIS} />
<br />
<button type="submit">Search</button>
</form>
-->
{/if}
<button id="reset" type="reset" on:click={reset}>Reset</button>
<Nav />