feat: introduce snackbars for GQL errors

This commit is contained in:
Ali BARIN
2021-10-23 18:53:48 +02:00
parent 3e6220c39e
commit c7d757a337
4 changed files with 72 additions and 16 deletions

View File

@@ -1,10 +1,23 @@
import { ApolloClient } from '@apollo/client';
import cache from './cache';
import createLink from './link';
import appConfig from 'config/app';
type CreateClientOptions = {
onError?: (message: string) => void;
};
const client = new ApolloClient({
uri: appConfig.graphqlUrl,
cache
cache,
link: createLink({ uri: appConfig.graphqlUrl })
});
export function setLink({ onError }: CreateClientOptions) {
const link = createLink({ uri: appConfig.graphqlUrl, onError });
client.setLink(link);
return client;
};
export default client;