I'd like to pick details from the thrown error and be able to use it. How do I 'read through' the caught error?
const submitRegister = async () => {
try {
const data = await axios.post(apiurl, {email: email, password: password, auth: auth})
console.log(data.data)
navigation.navigate('LoginScreen')
}
catch (error) {
console.log(error)
setErrorMessage('Error 400. Display actual {data:{errormessage:xxx}} from response here')
}
}