diff --git a/mock/rule.js b/mock/rule.js index 35d36c3b4fb80b12ab15964a158f63f0ff0789ec..87d235b03ef83f4d229ef4dd2812a8a83a219ecc 100644 --- a/mock/rule.js +++ b/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 { diff --git a/src/pages/List/TableList.js b/src/pages/List/TableList.js index 102cf858f090d5ec9f04ef2ab7dc46350e62841f..13f5fb60d04ebfd2dbb78420bfb36e600aa8c12e 100644 --- a/src/pages/List/TableList.js +++ b/src/pages/List/TableList.js @@ -483,12 +483,16 @@ class TableList extends PureComponent { handleUpdate = fields => { const { dispatch } = this.props; + const { formValues } = this.state; dispatch({ type: 'rule/update', payload: { - name: fields.name, - desc: fields.desc, - key: fields.key, + query: formValues, + body: { + name: fields.name, + desc: fields.desc, + key: fields.key, + }, }, }); diff --git a/src/services/api.js b/src/services/api.js index 8cdf4fa889b434f4f8fe2b8c43d0831c7a1d42d6..f79cefffb2981a3879608e66eb0a27cea1dd9f58 100644 --- a/src/services/api.js +++ b/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', }, });