提交 fed46a1a8239afc4095f86b2286d7fd663d6d307

作者 愚道
1 个父辈 36591d9d

improve basicForm

1 1 export default {
2   - 'POST /api/forms': (req, res) => {
  2 + 'POST /api/BLOCK_NAME/forms': (req, res) => {
3 3 res.send({ message: 'Ok' });
4 4 },
5 5 };
... ...
... ... @@ -22,17 +22,17 @@ const { RangePicker } = DatePicker;
22 22 const { TextArea } = Input;
23 23
24 24 @connect(({ loading }) => ({
25   - submitting: loading.effects['form/submitRegularForm'],
  25 + submitting: loading.effects['BLOCK_NAME/submitRegularForm'],
26 26 }))
27 27 @Form.create()
28   -class BasicForms extends PureComponent {
  28 +class PAGE_NAME_UPPER_CAMEL_CASE extends PureComponent {
29 29 handleSubmit = e => {
30 30 const { dispatch, form } = this.props;
31 31 e.preventDefault();
32 32 form.validateFieldsAndScroll((err, values) => {
33 33 if (!err) {
34 34 dispatch({
35   - type: 'form/submitRegularForm',
  35 + type: 'BLOCK_NAME/submitRegularForm',
36 36 payload: values,
37 37 });
38 38 }
... ... @@ -244,4 +244,4 @@ class BasicForms extends PureComponent {
244 244 }
245 245 }
246 246
247   -export default BasicForms;
  247 +export default PAGE_NAME_UPPER_CAMEL_CASE;
... ...
1   -import { routerRedux } from 'dva/router';
2 1 import { message } from 'antd';
3 2 import { fakeSubmitForm } from './service';
4 3
5 4 export default {
6   - namespace: 'form',
  5 + namespace: 'BLOCK_NAME',
7 6
8 7 state: {},
9 8
... ...
1 1 import request from 'umi-request';
2 2
3 3 export async function fakeSubmitForm(params) {
4   - return request('/api/forms', {
  4 + return request('/api/BLOCK_NAME/forms', {
5 5 method: 'POST',
6 6 body: params,
7 7 });
... ...
注册登录 后发表评论