MCPcopy Create free account
hub / github.com/Hazrat-Ali9/Problem-Solving-Frontend / UpdateUser

Function UpdateUser

app/admin/users/_UI/UpdateUser.tsx:6–44  ·  view source on GitHub ↗
({ record }: { record: any })

Source from the content-addressed store, hash-verified

4import toast from "react-hot-toast";
5// Update User Tsx
6const UpdateUser = ({ record }: { record: any }) => {
7 console.log(record);
8 const onFinish = (values: any) => {
9 try {
10 const result = updateUser(record.id, values);
11 toast.success("User updated successfully!");
12 window.location.reload();
13 } catch (error) {
14 console.error("Error updating user:", error);
15 }
16 };
17 return (
18 <Form
19 onFinish={onFinish}
20 layout="vertical"
21 name="form_in_modal"
22 initialValues={{ ...record }}
23 className="w-[300px]"
24 >
25 <Form.Item label="Name" name="name">
26 <Input disabled />
27 </Form.Item>
28 <Form.Item label="Email" name="email">
29 <Input disabled />
30 </Form.Item>
31 <Form.Item label="Role" name="role">
32 <Select>
33 <Select.Option value="user">User</Select.Option>
34 <Select.Option value="admin">Admin</Select.Option>
35 </Select>
36 </Form.Item>
37 <Form.Item>
38 <Button type="primary" htmlType="submit">
39 Save
40 </Button>
41 </Form.Item>
42 </Form>
43 );
44};
45
46export default UpdateUser;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected