Skip to content

Commit 8e55d02

Browse files
author
Ivan Beloborodov
committed
fix and remove duplicate error handling
1 parent 04bcaff commit 8e55d02

File tree

2 files changed

+2
-12
lines changed

2 files changed

+2
-12
lines changed

src/apolo/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const filter_out_error_set = {
1010
};
1111

1212
export const globalErrorHandler = ({ networkError = {}, graphQLErrors = [] }) => {
13-
if (networkError.statusCode === 500) {
13+
if (networkError && networkError.statusCode === 500) {
1414
window.logger.err("Internal server error");
1515
}
1616

src/hooks/index.js

+1-11
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,4 @@ export function useTranslations() {
1616
return result;
1717
}
1818

19-
export function useMutation(mutation, { onError, ...options } = {}) {
20-
return useApolloMutation(mutation, {
21-
onError: onError
22-
? error => {
23-
globalErrorHandler(error);
24-
onError(error);
25-
}
26-
: globalErrorHandler,
27-
...options
28-
});
29-
}
19+
export const useMutation = useApolloMutation;

0 commit comments

Comments
 (0)