/** * Copyright (c) OpenSpug Organization. https://github.com/openspug/spug * Copyright (c) * Released under the AGPL-3.0 License. */ import React, { useState } from 'react'; import { observer } from 'mobx-react'; import { Modal, Form, Input, message } from 'antd'; import http from 'libs/http'; import store from './store'; export default observer(function () { const [form] = Form.useForm(); const [loading, setLoading] = useState(false) function handleSubmit() { setLoading(true); const formData = form.getFieldsValue(); formData['id'] = store.record.id; http.post('/api/app/', formData) .then(res => { message.success('操作成功'); store.formVisible = false; store.fetchRecords() }, () => setLoading(false)) } return ( store.formVisible = false} confirmLoading={loading} onOk={handleSubmit}>
) })