我正在尝试与此请求一起传递图像,但发送其他参数,但不发送图像。有什么办法会更好。 const update = dispatch => async ({ name, email, phone, photo, Age, Blood, Gender, Height, Weight, id }) => {
//make api request to update with that info
// const picture = new FormData()
// picture.append("picture", {
// type: 'image/jpg',
// uri: photo,
// name: 'profilepic.jpg'
// });
// const picture = {
// type: 'image/jpg',
// uri: photo,
// name: 'profilepic.jpg'
// }
// console.log(picture)
const picture = {
type: 'image/jpg',
uri: photo,
name: 'profilepic.jpg'
}
const response = await appApi.put(`/userregister/${id}`, { name, email, phone, picture, Age, Blood, Gender, Height, Weight })
if (response) {
console.log(response.data)
navigate("AccountScrn");
} else {
dispatch({
type: "ADD_ERROR",
payload: 'Unable to update profile, please try again later'
})
}
};
我正在尝试与此请求一起传递图像,但发送其他参数,但不发送图像。有什么办法会更好。 appApi是我导入的axios实例。 const update = dispatch =&...
FormData
: