I cannot resolve this promise using fetch I want 2 values to go the .then(data) I want to use the status as wall as the JSON that I got form the back-end, then inherit the incoming status but the resp.json is always showing a and I cannot access its value any idea ?
fetch('/signup', { credentials: "same-origin", mode: "same-origin", method: 'POST', headers: { "Content-Type": "application/json" }, body: JSON.stringify(inputJSON) }) .then(resp => { return [resp.json(), resp.status] }) .then(function (data) { console.log(data); let Status = data[1] let jsonData = data[0] let p = jsonData.then(e => { return e }) console.log(p); }) } })
.then(resp => { return [resp.json(), resp.status]to.then(resp => { return resp.json()and then in next.thenyourdatawill have entirerespobject. Extract what you need fromdata