Accounts component

This commit is contained in:
Ariadna 2025-04-20 02:02:47 -04:00
parent 8bf166f134
commit fe96164f4e
Signed by: ari
SSH key fingerprint: SHA256:j4xpQafvRcIH4rwZqM5aREIogWsCjyYohia7vH0+uZY
4 changed files with 85 additions and 21 deletions

View file

@ -1,19 +1,35 @@
<script lang="ts">
import PostComponent from "./lib/PostComponent.svelte";
import { fetchAllPosts, Post } from "./lib/pdsfetch";
import AccountComponent from "./lib/AccountComponent.svelte";
import { fetchAllPosts, Post, getAllMetadataFromPds } from "./lib/pdsfetch";
const postsPromise = fetchAllPosts();
const accountsPromise = getAllMetadataFromPds();
</script>
<main>
<h1>Welcome to the Feed</h1>
{#await accountsPromise}
<p>Loading...</p>
{:then accountsData}
<div id="Account">
{#each accountsData as accountObject}
<AccountComponent account={accountObject} />
{/each}
</div>
{:catch error}
<p>Error: {error.message}</p>
{/await}
{#await postsPromise}
<p>Loading...</p>
{:then postsData}
{#each postsData as postObject}
<PostComponent post={postObject as Post} />
{/each}
<div id="Feed">
{#each postsData as postObject}
<PostComponent post={postObject as Post} />
{/each}
</div>
{/await}
</main>
<style>
</style>