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