code is working fine until publish the app but after publishing multipart api not working at all.
please review my code, your help will be very thankful to me.
addClient() {
if (this.checkFieldsValidation(firstName, lastName, phoneNo)) {
let formdata = new FormData();
if (this.state.uri)
formdata.append(“profileImage”, { uri: this.state.uri, name: ‘photo.jpg’, type: ‘image/jpg’ })
else
formdata.append(“profileImage”, ‘’)
formdata.append(“businessId”, businessId)
formdata.append(“firstName”, firstName)
formdata.append(“lastName”, lastName)
formdata.append(“phoneNumber”, phoneNo)
formdata.append(“countryCode”, this.state.phoneCode)
alert(JSON.stringify(formdata))
fetch(language.en.BaseUrl+‘api/addBusinessClient’, {
method: ‘post’,
headers: {
‘Content-Type’: ‘multipart/form-data’,
‘authorization’: accessToken,
‘userId’: userId
},
body: formdata
}).then(response => response.json())
.then(responseJson => {
if (responseJson.code == 200) {
// this.props.navigator.push(‘listClientBooking’);
self.props.hitGetClient(accessToken, businessId)
self.props.navigator.pop();
// alert(JSON.stringify(responseJson))
} else {
alert(JSON.stringify(responseJson))
}
})
.catch(error => {
return false;
});
}
}