From ecf0c277f6505887a173e7a130a3b0f5ef8ea692 Mon Sep 17 00:00:00 2001 From: BennyKok Date: Mon, 25 Dec 2023 13:09:52 +0800 Subject: [PATCH] fix(web): token not being saved --- web/src/components/InsertModal.tsx | 8 ++++++++ web/src/components/MachineList.tsx | 14 -------------- web/src/server/createRun.ts | 5 +++++ web/src/server/curdMachine.ts | 8 +++----- 4 files changed, 16 insertions(+), 19 deletions(-) diff --git a/web/src/components/InsertModal.tsx b/web/src/components/InsertModal.tsx index cb6251e..3d0e2f0 100644 --- a/web/src/components/InsertModal.tsx +++ b/web/src/components/InsertModal.tsx @@ -14,6 +14,7 @@ import { DialogTrigger, } from "@/components/ui/dialog"; import * as React from "react"; +import { useState } from "react"; import type { UnknownKeysParam, ZodObject, ZodRawShape, z } from "zod"; export function InsertModal< @@ -83,8 +84,13 @@ export function UpdateModal< fieldConfig?: FieldConfig>; }) { // const [open, setOpen] = React.useState(false); + const [values, setValues] = useState>>({}); const [isLoading, setIsLoading] = React.useState(false); + React.useEffect(() => { + setValues(props.data); + }, [props.data]); + return ( {/* @@ -96,6 +102,8 @@ export function UpdateModal< {props.description} { diff --git a/web/src/components/MachineList.tsx b/web/src/components/MachineList.tsx index fdca613..cb396be 100644 --- a/web/src/components/MachineList.tsx +++ b/web/src/components/MachineList.tsx @@ -187,20 +187,6 @@ export const columns: ColumnDef[] = [ ) => { + async (data: z.infer) => { const { userId } = auth(); if (!userId) return { error: "No user id" }; - console.log(name, endpoint); + // console.log(name, endpoint); await db.insert(machinesTable).values({ + ...data, user_id: userId, - name, - endpoint, - type, }); revalidatePath("/machines"); return { message: "Machine Added" };