<script lang="ts" context="module">
  import type { Load } from '@sveltejs/kit';
  import { fetchStatus, type MastodonStatus } from '$lib/mastoapi/status';

  export const load: Load = async ({ session, params }) => {
    try {
      const status = await fetchStatus(session.instance, params.id);
      return { props: { status } };
    } catch (err) {
      return { status: 404, error: err as Error };
    }
  };
</script>

<script lang="ts">
  import Status from '$lib/components/Status.svelte';
  export let status: MastodonStatus;
</script>

{#if status != null}
  <Status {status} />
{:else}
  <p>a</p>
{/if}
