mirror of
https://github.com/danbulant/design
synced 2026-07-05 11:00:38 +00:00
fix eager post load
This commit is contained in:
parent
ccdf7df313
commit
fc059a688a
1 changed files with 7 additions and 7 deletions
|
|
@ -9,10 +9,10 @@
|
||||||
|
|
||||||
console.error($page.error);
|
console.error($page.error);
|
||||||
|
|
||||||
function loadPosts() {
|
// function loadPosts() {
|
||||||
let posts = fetch("/api/posts.json").then(t => t.json()).catch(t => []);
|
// let posts = fetch("/api/posts.json").then(t => t.json()).catch(t => []);
|
||||||
return posts;
|
// return posts;
|
||||||
}
|
// }
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<h1 class="text-center">
|
<h1 class="text-center">
|
||||||
|
|
@ -33,7 +33,7 @@
|
||||||
<Button href="/">Go to my home page</Button>
|
<Button href="/">Go to my home page</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#await loadPosts() then posts}
|
<!-- {#await loadPosts() then posts}
|
||||||
{#if posts && posts.length > 0}
|
{#if posts && posts.length > 0}
|
||||||
<div class="my-4 separator text-big">OR</div>
|
<div class="my-4 separator text-big">OR</div>
|
||||||
|
|
||||||
|
|
@ -51,8 +51,8 @@
|
||||||
</main>
|
</main>
|
||||||
{/if}
|
{/if}
|
||||||
{:catch error}
|
{:catch error}
|
||||||
<!-- Couldn't load -->
|
<!-- Couldn't load ->
|
||||||
{/await}
|
{/await} -->
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.flex {
|
.flex {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue