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