Sapper (svelte) route component

<svelte:head>
    <title>Foo</title>
</svelte:head>

{#each items as item}
    {item}<br>
{:else}
    You don't have any items yet
{/each}

<script context="module">
    export async function preload (page, session) {
        try {
            let r = await this.fetch(session.origin + `/api/foo`)
            return r.ok ? r.json() : this.error(r.status, r.statusText)
        } catch (e) {
            return this.error(503, "Check your network connection")
        }
    }
</script>

<script>
    export let items
</script>