fix(web): token not being saved
This commit is contained in:
@@ -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<z.infer<Z>>;
|
||||
}) {
|
||||
// const [open, setOpen] = React.useState(false);
|
||||
const [values, setValues] = useState<Partial<z.infer<Z>>>({});
|
||||
const [isLoading, setIsLoading] = React.useState(false);
|
||||
|
||||
React.useEffect(() => {
|
||||
setValues(props.data);
|
||||
}, [props.data]);
|
||||
|
||||
return (
|
||||
<Dialog open={props.open} onOpenChange={props.setOpen}>
|
||||
{/* <DialogTrigger asChild>
|
||||
@@ -96,6 +102,8 @@ export function UpdateModal<
|
||||
<DialogDescription>{props.description}</DialogDescription>
|
||||
</DialogHeader>
|
||||
<AutoForm
|
||||
values={values}
|
||||
onValuesChange={setValues}
|
||||
fieldConfig={props.fieldConfig}
|
||||
formSchema={props.formSchema}
|
||||
onSubmit={async (data) => {
|
||||
|
||||
@@ -187,20 +187,6 @@ export const columns: ColumnDef<Machine>[] = [
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
<UpdateModal
|
||||
fieldConfig={{
|
||||
name: {
|
||||
inputProps: { defaultValue: machine.name },
|
||||
},
|
||||
endpoint: {
|
||||
inputProps: { defaultValue: machine.endpoint },
|
||||
},
|
||||
type: {
|
||||
inputProps: { defaultValue: machine.type },
|
||||
},
|
||||
auth_token: {
|
||||
inputProps: { defaultValue: machine.auth_token ?? "" },
|
||||
},
|
||||
}}
|
||||
data={machine}
|
||||
open={open}
|
||||
setOpen={setOpen}
|
||||
|
||||
Reference in New Issue
Block a user