List of invitations

This commit is contained in:
Eric van der Vlist 2023-02-21 16:03:54 +01:00
parent 46135c3a6e
commit fbdb652bd7
3 changed files with 49 additions and 0 deletions

View File

@ -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> = (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 (
<ul>
<For each={invitations.result}>
{(invitation: any) => {
console.log({
caller: "Invitations / loop",
invitations: invitation,
});
return <li>{invitation.id}</li>;
}}
</For>
</ul>
);
};
export default Invitations;

View File

@ -0,0 +1 @@
export { default } from "./Invitations";

View File

@ -1,7 +1,10 @@
import Invitations from "~/components/invitations";
export default () => { export default () => {
return ( return (
<main> <main>
<h1>Invitations</h1> <h1>Invitations</h1>
<Invitations />
</main> </main>
); );
}; };