-1
Good morning. I want to display the 400 error on front(RN) that back(Node) provides, using fetch.
function add(){
fetch(`http://localhost:3000/AOTT7C1TT75a8s5RH1TR/${desc._id}/skaoskao`,{
method: 'post',
headers: {
user:`${Home.user._id}`,
"Authorization":`Bearer ${token}`
}
})
.then(res => res.json())
.then(res => {
--> console.log(res)
})
}
I can get the bug on that console.log(res)
that returns to me {"error": "Você já pediu esse produto"}
but I do not understand how I pass this error to mobile screen(RN)
Thank you for your attention.