]> git.r.bdr.sh - rbdr/forum/blame - src/routes/p/[id].svelte
Use supabase
[rbdr/forum] / src / routes / p / [id].svelte
CommitLineData
cac85db0 1<script lang="ts" context="module">
58f7d521 2 export const load = ({
852ee620 3 params: { id }
58f7d521
RBR
4 }) => ({ props: { id } });
5</script>
6
cac85db0 7<script lang="ts">
58f7d521 8 import { _ } from 'svelte-i18n';
852ee620 9 import { post } from '$lib/stores/posts';
a7cf03c1
RBR
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';
58f7d521 13
be1ce532 14 export let id: string;
58f7d521 15
852ee620 16 $: postResponse = post(id, true);
58f7d521
RBR
17</script>
18
19<svelte:head>
20 <title>{$_('post.post')}}</title>
21</svelte:head>
22
852ee620 23{#if $postResponse.loading}
58f7d521
RBR
24 <Loader />
25{/if}
852ee620 26{#if $postResponse.error}
58f7d521
RBR
27 <ErrorBlock message={$_('post.error.unavailable')} />
28{/if}
852ee620
RBR
29{#if $postResponse.data}
30 <Post post={$postResponse.data} />
58f7d521 31{/if}