Commit bdc92d5c authored by 何乐's avatar 何乐 Committed by ι™ˆεΈ…

enhance TableList: auto search after editing (#3380)

parent acd67d21
...@@ -122,14 +122,7 @@ function postRule(req, res, u, b) { ...@@ -122,14 +122,7 @@ function postRule(req, res, u, b) {
break; break;
} }
const result = { return getRule(req, res, u);
list: tableListDataSource,
pagination: {
total: tableListDataSource.length,
},
};
return res.json(result);
} }
export default { export default {
......
...@@ -483,12 +483,16 @@ class TableList extends PureComponent { ...@@ -483,12 +483,16 @@ class TableList extends PureComponent {
handleUpdate = fields => { handleUpdate = fields => {
const { dispatch } = this.props; const { dispatch } = this.props;
const { formValues } = this.state;
dispatch({ dispatch({
type: 'rule/update', type: 'rule/update',
payload: { payload: {
name: fields.name, query: formValues,
desc: fields.desc, body: {
key: fields.key, name: fields.name,
desc: fields.desc,
key: fields.key,
},
}, },
}); });
......
...@@ -33,11 +33,11 @@ export async function addRule(params) { ...@@ -33,11 +33,11 @@ export async function addRule(params) {
}); });
} }
export async function updateRule(params) { export async function updateRule(params = {}) {
return request('/api/rule', { return request(`/api/rule?${stringify(params.query)}`, {
method: 'POST', method: 'POST',
body: { body: {
...params, ...params.body,
method: 'update', method: 'update',
}, },
}); });
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment