1๐
Iโve figured it out โ Iโm using snakecaseKeys
package to manipulate the data before sending. It seems not to play well with FormData objects.
import snakecaseKeys from 'snakecase-keys'
axios.defaults.transformRequest = [(data) => {
if (data) {
return snakecaseKeys(data, { deep: true })
}
}, ...axios.defaults.transformRequest]
Thanks for the comments guys!
0๐
In case anyone else runs into this issue, you can side-step the transformations in you transformRequest using instanceof
.
transformRequest: [
(data) => {
if (data instanceof FormData) return data;
// otherwise, transform your data
return transformedData;
},
],
- [Vuejs]-Passing the Div id to another vue component in laravel
- [Vuejs]-Remove category_id property from ColumnValue object in Vue template
-2๐
in React the form should also have encType="multipart/form-data" attribute, may be in vue also?
- [Vuejs]-Vuejs testing โ Ava โ Changing propData
- [Vuejs]-Vue โ how to use an event handler to invoke functions from sibling/child
Source:stackexchange.com