fix undefined check
This commit is contained in:
parent
590c0a0d43
commit
fc5f3e9b08
1 changed files with 14 additions and 14 deletions
|
|
@ -7,19 +7,19 @@
|
|||
let posts = $derived(data.posts);
|
||||
</script>
|
||||
|
||||
{#if posts.length === 0}
|
||||
{#if !posts || posts.length === 0}
|
||||
<h3 class="text-center text-lg font-semibold">Looks like I haven't posted anything yet!</h3>
|
||||
{:else}
|
||||
<div class="mx-auto grid gap-8 px-3 py-3 sm:px-8 sm:py-4 lg:grid-cols-2">
|
||||
{#each posts as post (post.id)}
|
||||
<BlogCard
|
||||
id={post.id}
|
||||
img={post.image.url}
|
||||
img-alt={post.image.alt}
|
||||
title={post.title}
|
||||
published={post.published}
|
||||
topics={post.topics}
|
||||
/>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="mx-auto grid gap-8 px-3 py-3 sm:px-8 sm:py-4 lg:grid-cols-2">
|
||||
{#each posts as post (post.id)}
|
||||
<BlogCard
|
||||
id={post.id}
|
||||
img={post.image.url}
|
||||
img-alt={post.image.alt}
|
||||
title={post.title}
|
||||
published={post.published}
|
||||
topics={post.topics}
|
||||
/>
|
||||
{/each}
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue