【发布时间】:2020-04-27 09:00:37
【问题描述】:
我有这个函数可以向/api/lyric/tag发出 axios put 请求
const addTag = async (name, tagId, lyricId) => {
const body = {name, tagId, lyricId};
await axios.put(`/api/lyric/tag`, JSON.stringify(body), { headers: {'Content-Type': 'application/json'} });
}
目前/api/lyric/tag的路线完全是空的:
// @route PUT api/lyric/tag
// @desc Add tag to lyric
// @access Private
router.put('/tag', auth, async (req, res) => {
});
但由于某种原因,每次 axios 发出 put 请求时,我都会收到此错误:
Cast to ObjectId failed for value "tag" at path "_id" for model "lyric"
我是不是疯了?
【问题讨论】: