Run formatter
This commit is contained in:
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user