Skip to content

Commit

Permalink
fix: 🐛 Permet de masquer les messages d'erreur graphQL (#1429)
Browse files Browse the repository at this point in the history
  • Loading branch information
benguedj authored Sep 5, 2022
1 parent baefebf commit 694ce60
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions front/src/components/app/checkAppVersion.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const CheckAppVersion: FC = () => {
query={ConfigQueries.CONFIG_GET_LAST_APP_VERSION}
fetchPolicy={FetchPoliciesConstants.NO_CACHE}
getFetchedData={handleResults}
showErrorMessage={false}
/>
);
};
Expand Down
4 changes: 3 additions & 1 deletion front/src/services/graphQL/graphQLQueries.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ interface Props {
notifyOnNetworkStatusChange?: boolean;
noLoader?: boolean;
noLoaderBackdrop?: boolean;
showErrorMessage?: boolean;
}

export const GraphQLQuery: FC<Props> = ({
Expand All @@ -23,6 +24,7 @@ export const GraphQLQuery: FC<Props> = ({
notifyOnNetworkStatusChange,
noLoader,
noLoaderBackdrop,
showErrorMessage = true,
}) => {
const { loading, error, data } = useQuery(gql(query), {
fetchPolicy: fetchPolicy ?? FetchPoliciesConstants.NETWORK_ONLY,
Expand All @@ -36,7 +38,7 @@ export const GraphQLQuery: FC<Props> = ({
return (
<GraphQLLoader noLoader={noLoader} noLoaderBackdrop={noLoaderBackdrop} />
);
if (error) return <ErrorMessage error={error} />;
if (error && showErrorMessage) return <ErrorMessage error={error} />;
return null;
};

Expand Down

0 comments on commit 694ce60

Please sign in to comment.