Run formatter

This commit is contained in:
Fred Boniface
2023-07-07 22:07:37 +01:00
parent 8a7c78219f
commit b6dca2df78
3 changed files with 68 additions and 67 deletions

View File

@@ -1,18 +1,17 @@
<script>
import { uuid } from "$lib/stores/uuid";
import { uuid } from '$lib/stores/uuid';
export let code = '';
export let type = '';
async function getDelay(code = '') {
console.log(`Fetching delay reason ${code}`)
console.log(`Fetching delay reason ${code}`);
const data = await getReason(code);
return data[0].lateReason || 'This train has been delayed';
}
async function getCancel(code = '') {
console.log(`Fetching cancel reason ${code}`)
console.log(`Fetching cancel reason ${code}`);
const data = await getReason(code);
return data[0].cancReason || 'This train has been cancelled';
}
@@ -28,23 +27,22 @@
const res = await fetch(url, options);
return await res.json();
}
</script>
{#if type === "cancel"}
{#if type === 'cancel'}
{#await getCancel(code)}
This train has been cancelled
{:then reason}
{:then reason}
{reason}
{:catch}
This train has been cancelled
{/await}
{:else if type === "delay"}
{:else if type === 'delay'}
{#await getDelay(code)}
This train has been delayed
This train has been delayed
{:then reason}
{reason}
{:catch}
This train has been delayed
{/await}
{/if}
{/if}