1 <script lang="ts" context="module">
2 export const load = ({ params: { id } }) => ({ props: { id } });
6 import { onDestroy } from 'svelte';
7 import { _ } from 'svelte-i18n';
8 import { topic } from '$lib/stores/topics';
9 import { disableTopicActions, enableTopicActions } from '$lib/stores/actions';
11 import Topic from '$lib/components/topic/topic.svelte';
12 import ErrorBlock from '$lib/components/error_block/error_block.svelte';
13 import Loader from '$lib/components/loader/loader.svelte';
15 export let id: string;
17 $: response = topic(id, true);
19 enableTopicActions(id);
20 onDestroy(() => disableTopicActions());
24 {#if $response.loading}
25 <title>{$_('loader.message')}, {$_('topic.title')}</title>
28 <title>{$_('error.generic.title')}, {$_('topic.title')}</title>
31 <title>{$response.data.title}, {$_('topic.title')}</title>
35 {#if $response.loading}
39 <ErrorBlock message={$_('topic.error.unavailable')} />
42 <Topic topic={$response.data} />