dva-example-user-dashboard icon indicating copy to clipboard operation
dva-example-user-dashboard copied to clipboard

创建用户、编辑用户不生效

Open xl778518694 opened this issue 7 years ago • 2 comments

使用本地json-server时,编辑用户创建用户操作不生效; 需要在访问request方法时,初始化options参数的headers 文件:services/user.js

export function patch(id, values) {
  return request(`/api/users/${id}`, {
    method: 'PATCH',
    body: JSON.stringify(values),
    headers: {
      "Content-Type": "application/json"
    },
  });
}

export function create(values) {
  return request('/api/users', {
    method: 'POST',
    headers: {
      "Content-Type": "application/json"
    },
    body: JSON.stringify(values),
  });
}

使用线上json-server时,编辑用户创建用户操作始终不生效;

xl778518694 avatar Jun 09 '17 07:06 xl778518694

我也有类似的问题,删除、编辑、创建功能都不会生效。

jokersandwich avatar Jun 18 '17 04:06 jokersandwich

查看 chrome 的 network,看看请求的数据是否正确,如果数据有问题改 mock,如果数据没有问题看看组件接收数据以后的操作

nikogu avatar Jul 17 '17 03:07 nikogu