import { createForm } from '@felte/solid'; import { Component, createUniqueId } from 'solid-js'; import { TextField, Button } from '@kobalte/core'; import './style.css'; import { createServerAction$ } from 'solid-start/server'; import PouchDb from 'pouchdb'; import { v4 as uuid } from 'uuid'; interface Props {} const Invitation: Component = (props) => { const [saving, save] = createServerAction$(async (values: any) => { const db = new PouchDb('.db'); const id = `invitation/${uuid()}`; await db.put({ _id: id, type: 'invitation', ...values, date: new Date().toISOString(), }); return id; }); const submitHandler = (values: any, context: any) => { console.log({ caller: 'Invitation / submitHandler', props, values, context, }); save(values); }; const { form } = createForm({ onSubmit: submitHandler }); return (
Mail address Please provide a valid URL Database Please provide a valid URL Password Please provide a valid password Create
); }; export default Invitation;