-
-
Notifications
You must be signed in to change notification settings - Fork 153
Fetch errors not working correctly with the useMutation React hook #222
Copy link
Copy link
Closed
Labels
Description
When I use createUploadLink in my React app
const httpLink = createUploadLink({
uri: 'http://localhost:4000/graphql"',
});
const client = new ApolloClient({
link: from([authMiddleware, httpLink]),
cache: new InMemoryCache(),
});
I cannot catch errors thrown by Mutations using useMutation()
const onSubmit = (data) => {
mutationLogin({ variables: data })
.then // it works when the mutation doesn't throw
.catch // never goes in it even when the mutation throw
And on the browser console I get the error below
createUploadLink.js:148 Fetch failed loading: POST "http://localhost:4000/graphql".
And when use HttpLink from @apollo/client it works perfectly fine
const httpLink = new HttpLink({
uri: 'http://localhost:4000/graphql"',
});
Reactions are currently unavailable