storybook/docs/snippets/svelte/apollo-wrapper-component.with-mock-implementation.js.mdx
2023-12-06 14:28:38 +00:00

28 lines
546 B
Plaintext

```html
<!-- MockApolloWrapperClient.svelte -->
<script>
import { ApolloClient, InMemoryCache } from '@apollo/client';
import { setClient } from 'svelte-apollo';
const mockedClient = new ApolloClient({
uri: 'https://your-graphql-endpoint',
cache: new InMemoryCache(),
defaultOptions: {
watchQuery: {
fetchPolicy: 'no-cache',
errorPolicy: 'all',
},
query: {
fetchPolicy: 'no-cache',
errorPolicy: 'all',
},
},
});
setClient(mockedClient);
</script>
<slot />
```