);
}
diff --git a/src/app/_components/CreateWine.tsx b/src/app/_components/CreateWine.tsx
index b619c55..46395bb 100644
--- a/src/app/_components/CreateWine.tsx
+++ b/src/app/_components/CreateWine.tsx
@@ -35,9 +35,9 @@ export default function CreateWine() {
loadProducers();
}, []);
return (
-
+
+ {JSON.stringify(formState)}
);
}
diff --git a/src/app/_components/FormCard.tsx b/src/app/_components/FormCard.tsx
new file mode 100644
index 0000000..d6e5791
--- /dev/null
+++ b/src/app/_components/FormCard.tsx
@@ -0,0 +1,10 @@
+import CreateWine from "./CreateWine";
+
+export default function FormCard() {
+ return (
+
+
Add a new wine
+
+
+ );
+}
diff --git a/src/app/_components/WineCards.tsx b/src/app/_components/WineCards.tsx
deleted file mode 100644
index 678f2f1..0000000
--- a/src/app/_components/WineCards.tsx
+++ /dev/null
@@ -1,19 +0,0 @@
-import { getWines } from "~/server/actions/allWines";
-import WineName from "./WineName";
-import WineProducer from "./WineProducer";
-export const dynamic = "force-dynamic";
-
-const allWines = await getWines();
-export default async function WineCards() {
- return (
- <>
- {allWines.map((wine, i) => {
- return (
-
- -
-
- );
- })}
- >
- );
-}
diff --git a/src/server/actions/addWine.ts b/src/server/actions/addWine.ts
index 95ab41e..c09cf65 100644
--- a/src/server/actions/addWine.ts
+++ b/src/server/actions/addWine.ts
@@ -2,6 +2,7 @@
import { ZodError, z } from 'zod';
import { db } from '../db/index'
import { wines } from '../db/schema'
+import { QueryResult } from 'pg';
type NewWine = typeof wines.$inferInsert;
@@ -19,7 +20,7 @@ export type Fields = {
}
export type FormState = {
- message: string;
+ message: string | QueryResult
;
errors: Record | undefined;
fieldValues: NewWine;
}
@@ -39,9 +40,9 @@ export const addWine = async (
try {
schema.parse(newWine)
- const response = await db.insert(wines).values(newWine);
+ await db.insert(wines).values(newWine);
return {
- message: `success fully added ${response}`,
+ message: 'success',
errors: undefined,
fieldValues: {
name: "",