我认为该请求没有问题,因为我使用了相同的请求来发布新角色并且成功了。我认为问题出在回应上。
我有一个更新角色的API 路线。
router.put('/:id', (req, res, next) => {
const { id } = req.params;
Promise.all([
updateAbilities(id, req.body.abilities, next),
updateCharacter(id, req.body.name, req.body.img, next),
updateShows(id, req.body.shows, next)
])
.then(values => console.log(values, 'are the values received at put request'))
.then(() => res.redirect('/' + id))
.catch(err => next(err));
})
Run Code Online (Sandbox Code Playgroud)
当我使用Postman发送请求时,我得到了完美的响应。
我正在使用Axios在 React 应用程序上执行相同的请求。
export async function updateOne(inputs, cid) {
inputs = {
name: "green …Run Code Online (Sandbox Code Playgroud)