Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
xl778518694 opened this issue Jun 9, 2017 · 2 comments
Open

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

xl778518694 opened this issue Jun 9, 2017 · 2 comments

Comments

@xl778518694
Copy link

使用本地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时,编辑用户创建用户操作始终不生效;

@jokersandwich
Copy link

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

@nikogu
Copy link
Member

nikogu commented Jul 17, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants