I am using Graphql Apollo, React, and JS. We have form validation in our backend, when trying to display these errors on screen for better user experience, I cannot seem to find a way to access them. Within my browser console, the error I receive is just ‘ApolloError’, but within the network tab I can see the error message I’m trying to convey on the frontend. What is an easy way to access it? This is what I currently have as my code. Within ‘setAlerts’ that is the route to get to the error message if I were able to access the network tab. Thanks
try {
const { data } = await addUser({
variables: { username, email, password },
})
if (data.addUser === null) {
setAlerts(data.errors[0].message, "inline text-groove-red")
}
alert('Account creation successful!')
Auth.login(data.addUser.token);
navigate('/login')
} catch (err) {
console.error(err)
}
Attempted to log ‘ApolloError’ as well as ‘data’. When I log data within my catch block it comes back as not defined.