groups api route

This commit is contained in:
2024-03-12 23:07:07 +01:00
parent 3b1e627356
commit d62cc6f6a4
21 changed files with 488 additions and 15 deletions

View File

@@ -4,23 +4,23 @@
import { Button } from '$lib/components/ui/button';
import Player from '$lib/components/organisms/player.svelte';
import { onMount } from 'svelte';
import { PlayIcon, Loader, Plus, MailIcon } from 'lucide-svelte';
import { PlayIcon, Loader, Plus, MailIcon, PlusIcon } from 'lucide-svelte';
import CreateGroup from '$lib/components/organisms/create-group.svelte';
let script = "";
let opened = false;
let pods = [];
let groups = [];
let pods = []
onMount(async () => {
let res = await (await fetch("/")).json();
console.log(res);
script = res.script;
res = await (await fetch("/api/pods")).json();
console.log(res);
pods = res.pods;
res = await (await fetch("/api/groups")).json();
groups = res.groups;
});
</script>
{#if opened}
@@ -41,16 +41,16 @@
</Button>
{/each}
<Label>Your Newsletters</Label>
<Label>Your Groups</Label>
<div class="overflow-x-scroll scrollbars-hidden">
{#each pods as pod}
<CreateGroup />
{#each groups as group}
<Button class="mt-4 flex w-full flex-row justify-start rounded text-left" variant="secondary">
<div class="items-center justify-center rounded-lg p-2 pl-0">
<MailIcon class="h-4 w-4" />
</div>
<div>
<h3 class="text-md">{pod.title}</h3>
<p class="text-sm text-muted-foreground">{new Date(pod.date).toLocaleDateString('de')}</p>
<h3 class="text-md">{group.name}</h3>
</div>
</Button>
{/each}