import { Form, Input, Modal } from 'antd'; import React from 'react'; import { useTranslation } from 'react-i18next'; import { useDispatch, useSelector } from 'umi'; type FieldType = { name?: string; }; interface kFProps { getKfList: () => void; kb_id: string; } const FileCreatingModal: React.FC = ({ getKfList, kb_id }) => { const dispatch = useDispatch(); const [form] = Form.useForm(); const kFModel = useSelector((state: any) => state.kFModel); const { isShowCEFwModal } = kFModel; const { t } = useTranslation(); const handleCancel = () => { dispatch({ type: 'kFModel/updateState', payload: { isShowCEFwModal: false, }, }); }; const createDocument = async () => { try { const values = await form.validateFields(); const retcode = await dispatch({ type: 'kFModel/document_create', payload: { name: values.name, kb_id, }, }); if (retcode === 0) { getKfList && getKfList(); } } catch (errorInfo) { console.log('Failed:', errorInfo); } }; const handleOk = async () => { createDocument(); }; return (
label="File Name" name="name" rules={[{ required: true, message: 'Please input name!' }]} >
); }; export default FileCreatingModal;