list teams on home

This commit is contained in:
Dovi Cowan 2023-10-19 00:30:08 +01:00
parent f1fa5a9a2e
commit cfff09bd91
Signed by: dcowan
GPG key ID: C110D77558FBC227

View file

@ -6,9 +6,11 @@
database, database,
logOut, logOut,
loggedInUser, loggedInUser,
teams,
} from "../lib/appwrite"; } from "../lib/appwrite";
import { Link } from "svelte-navigator"; import { Link } from "svelte-navigator";
import Header from "../lib/Header.svelte"; import Header from "../lib/Header.svelte";
import { Query } from "appwrite";
// navigate("/login", {}); // navigate("/login", {});
@ -16,10 +18,7 @@
checkloggedin(); checkloggedin();
const lists = database.listDocuments( const lists = teams.list();
import.meta.env.VITE_APPWRITE_DB_ID,
"lists",
);
</script> </script>
<main class="container m-5"> <main class="container m-5">
@ -30,13 +29,15 @@
{#await lists} {#await lists}
Loading... Loading...
{:then lists} {:then lists}
{#if lists.total == 0} {#if lists.teams.length == 0}
You have no lists yet! <Link to="/lists/create" class="text-blue-400" You have no lists yet! <Link to="/lists/create" class="text-blue-400"
>Create one now</Link >Create one now</Link
> >
{/if} {/if}
{#each lists.documents as list} {#each lists.teams as list}
<Link class="text-blue-400" to="/list/{list['$id']}">{list['title']}</Link><br> <Link class="text-blue-400" to="/list/{list['$id']}"
>{list["name"]}</Link
><br />
{/each} {/each}
<Link class="text-blue-400" to="/lists/create">Create new list</Link> <Link class="text-blue-400" to="/lists/create">Create new list</Link>
{/await} {/await}