I try extract data and status request from request in react native, when utilize this code
function postUser(FirstName, LastName, Phone, Email, Password) {
let data = {
method: 'POST',
credentials: 'same-origin',
mode: 'same-origin',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
email: Email,
password: Password,
first_name: FirstName,
last_name: LastName,
phone: Phone
})
}
return fetch(URLPostUser, data)
.then(response => response.json())
}
in this result don't had status.
when change the return of function, i try get status, but in this case don't have access to data
function postUser(FirstName, LastName, Phone, Email, Password) {
let data = {
method: 'POST',
credentials: 'same-origin',
mode: 'same-origin',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
email: Email,
password: Password,
first_name: FirstName,
last_name: LastName,
phone: Phone
})
}
return fetch(URLPostUser, data)
}