diff --git a/package-lock.json b/package-lock.json index c8e11ef..9358237 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,8 @@ "@kobalte/core": "^0.6.1", "@types/pouchdb": "^6.4.0", "pouchdb": "^8.0.1", - "pouchdb-server": "^4.2.0" + "pouchdb-server": "^4.2.0", + "uuid": "^9.0.0" }, "devDependencies": { "@solidjs/meta": "^0.28.2", @@ -19,6 +20,7 @@ "@solidjs/testing-library": "^0.5.2", "@testing-library/jest-dom": "^5.16.5", "@types/testing-library__jest-dom": "^5.14.5", + "@types/uuid": "^9.0.0", "@vitest/coverage-c8": "^0.26.3", "@vitest/ui": "^0.26.3", "jsdom": "^20.0.3", @@ -2863,6 +2865,12 @@ "@types/jest": "*" } }, + "node_modules/@types/uuid": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.0.tgz", + "integrity": "sha512-kr90f+ERiQtKWMz5rP32ltJ/BtULDI5RVO0uavn1HQUOwjx0R1h0rnDYNL0CepF1zL5bSY6FISAfd9tOdDhU5Q==", + "dev": true + }, "node_modules/@types/yargs": { "version": "17.0.22", "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.22.tgz", @@ -8401,6 +8409,14 @@ "uuid": "8.3.2" } }, + "node_modules/pouchdb-utils/node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/pouchdb-validation": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/pouchdb-validation/-/pouchdb-validation-4.2.0.tgz", @@ -8432,6 +8448,14 @@ "promise-nodify": "^1.0.2" } }, + "node_modules/pouchdb/node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/prelude-ls": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", @@ -10043,9 +10067,9 @@ } }, "node_modules/uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz", + "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==", "bin": { "uuid": "dist/bin/uuid" } diff --git a/package.json b/package.json index 83d0e2d..2534b89 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "@solidjs/testing-library": "^0.5.2", "@testing-library/jest-dom": "^5.16.5", "@types/testing-library__jest-dom": "^5.14.5", + "@types/uuid": "^9.0.0", "@vitest/coverage-c8": "^0.26.3", "@vitest/ui": "^0.26.3", "jsdom": "^20.0.3", @@ -33,6 +34,7 @@ "@kobalte/core": "^0.6.1", "@types/pouchdb": "^6.4.0", "pouchdb": "^8.0.1", - "pouchdb-server": "^4.2.0" + "pouchdb-server": "^4.2.0", + "uuid": "^9.0.0" } } diff --git a/src/components/invitation/Invitation.tsx b/src/components/invitation/Invitation.tsx index 268ef60..1a4e55b 100644 --- a/src/components/invitation/Invitation.tsx +++ b/src/components/invitation/Invitation.tsx @@ -5,18 +5,20 @@ 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 uuid = createUniqueId(); + const id = `invitation/${uuid()}}`; await db.put({ - _id: `invitation/${uuid}`, + _id: id, type: "invitation", doc: values, }); + return id; }); const submitHandler = (values: any, context: any) => { diff --git a/src/components/invitations/Invitations.tsx b/src/components/invitations/Invitations.tsx index 8461a3f..4d09801 100644 --- a/src/components/invitations/Invitations.tsx +++ b/src/components/invitations/Invitations.tsx @@ -23,7 +23,7 @@ const Invitations: Component = (props) => { createEffect(() => { console.log({ caller: "Invitations", - routeData: invitations.result, + invitations: invitations.result, }); });