Created
November 26, 2018 17:14
-
-
Save stubailo/610f6319ef551499ffa0883d47df5d9f to your computer and use it in GitHub Desktop.
Revisions
-
stubailo created this gist
Nov 26, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ export const ErrorProvider = (props) => { // This is just a link that swallows all operations and returns the same thing // for every request: The specified error. const link = new ApolloLink((operation) => { return new Observable((observer) => { observer.next({ errors: props.graphQLErrors || [ {message: 'Unspecified error from ErrorProvider.'}, ], }); observer.complete(); }); }); const client = new ApolloClient({ link, cache: new InMemoryCache(), }); return ( <ApolloProvider client={client}> {props.children} </ApolloProvider> ); };