]> git.r.bdr.sh - rbdr/forum/blobdiff - src/routes/$layout.svelte
Add posts store pact test
[rbdr/forum] / src / routes / $layout.svelte
index 8fd2ae04c247ac23f8a08af1faf2076335663d6b..234d26ac0d7ae32dffe7d78ba4156c1d40079c12 100644 (file)
@@ -4,13 +4,16 @@
        import { isLoading } from 'svelte-i18n';
        import { _ } from 'svelte-i18n';
 
-       import { forums } from '$/stores/forums';
+       import { getForums } from '$/stores/forums';
 
        import ErrorBlock from '$/components/error_block/error_block.svelte';
        import ForumList from '$/components/forum_list/forum_list.svelte';
        import Header from '$/components/header/header.svelte';
        import Loader from '$/components/loader/loader.svelte';
        import Footer from '$/components/footer/footer.svelte';
+
+       $: store = getForums();
+       $: forums = $store.data;
 </script>
 
 {#if $isLoading}
                <slot />
        </main>
   <nav title={$_('forum_list.title')}>
-    {#if $forums.loading}
+    {#if $store.loading}
       <Loader />
     {/if}
-    {#if $forums.error}
+    {#if $store.error}
       <ErrorBlock message={$_('forum_list.error.unavailable')} />
     {/if}
-    {#if $forums.data}
-      <ForumList forums={$forums.data} />
+    {#if forums}
+      <ForumList forums={forums} />
     {/if}
   </nav>
        <Footer />