]> git.r.bdr.sh - rbdr/forum/blob - src/routes/p/[id].svelte
47755bee6b202f4aeb288a137f73527cc8ccf6cc
[rbdr/forum] / src / routes / p / [id].svelte
1 <script lang="ts" context="module">
2 export const load = ({ params: { id } }) => ({ props: { id } });
3 </script>
4
5 <script lang="ts">
6 import { _ } from 'svelte-i18n';
7 import { post } from '$lib/stores/posts';
8 import Post from '$lib/components/post/post.svelte';
9 import ErrorBlock from '$lib/components/error_block/error_block.svelte';
10 import Loader from '$lib/components/loader/loader.svelte';
11
12 export let id: string;
13
14 $: postResponse = post(id, true);
15 </script>
16
17 <svelte:head>
18 <title>{$_('post.post')}}</title>
19 </svelte:head>
20
21 {#if $postResponse.loading}
22 <Loader />
23 {/if}
24 {#if $postResponse.error}
25 <ErrorBlock message={$_('post.error.unavailable')} />
26 {/if}
27 {#if $postResponse.data}
28 <Post post={$postResponse.data} />
29 {/if}