Axios有一个内置的补丁方法。您可以通过将
axios.post('/api/v1/users',
{ "edited_field": "email", "email": email },
{ headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': crsfToken }, }
).then((response) => {
// Code
}).catch((error) => {
// Code
})
我有这个post方法,但我想创建一个补丁方法。我见过一些解决方案,他们发布了一个输入值为"patch"的表单,但由于我没有使用表单,我不知道必须如何完成。
欢迎任何帮助:D
提前感谢!
axios.post
替换为axios.patch
来修改当前的代码
axios.patch('/api/v1/users',
{ "edited_field": "email", "email": email },
{ headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': crsfToken }, }
).then((response) => {
// Code
}).catch((error) => {
// Code
})