Browse Source

enhance TableList: auto search after editing (#3380)

pull/3416/head
何乐 7 years ago
committed by 陈帅
parent
commit
bdc92d5c99
  1. 9
      mock/rule.js
  2. 4
      src/pages/List/TableList.js
  3. 6
      src/services/api.js

9
mock/rule.js

@ -122,14 +122,7 @@ function postRule(req, res, u, b) {
break;
}
const result = {
list: tableListDataSource,
pagination: {
total: tableListDataSource.length,
},
};
return res.json(result);
return getRule(req, res, u);
}
export default {

4
src/pages/List/TableList.js

@ -483,13 +483,17 @@ class TableList extends PureComponent {
handleUpdate = fields => {
const { dispatch } = this.props;
const { formValues } = this.state;
dispatch({
type: 'rule/update',
payload: {
query: formValues,
body: {
name: fields.name,
desc: fields.desc,
key: fields.key,
},
},
});
message.success('配置成功');

6
src/services/api.js

@ -33,11 +33,11 @@ export async function addRule(params) {
});
}
export async function updateRule(params) {
return request('/api/rule', {
export async function updateRule(params = {}) {
return request(`/api/rule?${stringify(params.query)}`, {
method: 'POST',
body: {
...params,
...params.body,
method: 'update',
},
});

Loading…
Cancel
Save