import { Button, Drawer, Modal } from "antd";
import React, { useContext, useEffect, useState } from "react";

import { UserEditorContext } from "./UserMenu";
import UserForm from "./UserForm";

export default function UserEditModal() {
	const { formLoading, modalOpen, setModalOpen, form } =
		useContext(UserEditorContext);
	const handleOk = () => {
		form.submit();
	};
	return (
		<Modal
			width={400}
			onOk={handleOk}
			centered
			open={modalOpen}
			confirmLoading={formLoading}
			onCancel={() => {
				setModalOpen(false);
			}}
			title={"编辑个人信息"}>
			<UserForm />
		</Modal>
	);
}
