i'm trying to send list of data using form_data in react-native , but it is posting first data only , how to achieve that in react native ,
My Data ,
var data = ["person_1","person_2","person_3"];
My Code ,
export function updateUsers(data,token) {
const fd = new FormData();
fd.append('first_name', data); // here i need to update all the data
return dispatch => {
axios({
method : 'patch',
url : SERVICE.url+"user/"+un+"/",
headers: {
'Authorization' : "Token "+token,
},
data : fd
})
.then(response => {
console.log("updateUser done . . .");
var data = response.data;
dispatch({
type: "UPDATE_USER",
data,
});
}).catch(error => {
console.log("got error in UPDATE_USER ", error);
});
}
}
but for now , only one data is updated at a time , so how can i achieve that .help me from this .