added search

This commit is contained in:
Clément Le Bihan
2024-05-05 19:35:53 +02:00
parent 6336bb144d
commit 55443045aa
4 changed files with 27 additions and 14 deletions
+3 -4
View File
@@ -87,15 +87,14 @@
{/if}
{#if order !== "default"}
<div class="font-light text-sm text-slate-500">
<div class="font-light text-sm text-slate-500 flex gap-2">
<span>{post.feed.name}</span> |
{#if post.authors?.length}
{#each post.authors as author}
<div class="author">
<div class="flex gap-1 items-center">
<QuillPenLine />
<span>{author}</span>
</div>
|
</div> |
{/each}
{/if}
<Time
+3 -5
View File
@@ -25,14 +25,12 @@ export async function register(email: string, username: string, password: string
return j.token as string;
}
export async function getPosts(token?: string) {
const opts = {
export async function getPosts(token: string) {
const r = await fetch(env.API_URL + '/entries', {
headers: {
Authorization: `Bearer ${token}`
}
}
const r = await fetch(env.API_URL + '/entries', token ? opts : undefined);
});
const j = await r.json();
console.log(j);
return j as Post[];
}