From fbdb652bd78d619adc58d14854aedfeef547a61a Mon Sep 17 00:00:00 2001 From: Eric van der Vlist Date: Tue, 21 Feb 2023 16:03:54 +0100 Subject: [PATCH] List of invitations --- src/components/invitations/Invitations.tsx | 45 ++++++++++++++++++++++ src/components/invitations/index.ts | 1 + src/routes/invitations/index.tsx | 3 ++ 3 files changed, 49 insertions(+) create mode 100644 src/components/invitations/Invitations.tsx create mode 100644 src/components/invitations/index.ts diff --git a/src/components/invitations/Invitations.tsx b/src/components/invitations/Invitations.tsx new file mode 100644 index 0000000..8461a3f --- /dev/null +++ b/src/components/invitations/Invitations.tsx @@ -0,0 +1,45 @@ +import PouchDb from "pouchdb"; +import { Component, createEffect, For } from "solid-js"; +import { createServerAction$ } from "solid-start/server"; + +interface Props {} + +const Invitations: Component = (props) => { + const [invitations, getInvitations] = createServerAction$( + async (values: any) => { + const db = new PouchDb(".db"); + const results = await db.allDocs({ + include_docs: true, + startkey: "invitation/", + endkey: "invitation/\ufff0", + }); + console.log({ caller: "Invitations / serverAction", results }); + return results.rows; + } + ); + + getInvitations(); + + createEffect(() => { + console.log({ + caller: "Invitations", + routeData: invitations.result, + }); + }); + + return ( + + ); +}; + +export default Invitations; diff --git a/src/components/invitations/index.ts b/src/components/invitations/index.ts new file mode 100644 index 0000000..cb3587b --- /dev/null +++ b/src/components/invitations/index.ts @@ -0,0 +1 @@ +export { default } from "./Invitations"; diff --git a/src/routes/invitations/index.tsx b/src/routes/invitations/index.tsx index 36f51ec..c427b96 100644 --- a/src/routes/invitations/index.tsx +++ b/src/routes/invitations/index.tsx @@ -1,7 +1,10 @@ +import Invitations from "~/components/invitations"; + export default () => { return (

Invitations

+
); };