Setting "cache-and-network" as default fetch policy

This commit is contained in:
Nikola Bjelo committed 2018-11-06 04:15:17 +01:00
1 parent f889f6c93c
commit 59669f23e7
1 file changed
+15
+15
View File
@@ -73,8 +73,23 @@ const authLink = setContext((_, { headers }) => {
const cache = new InMemoryCache().restore(window.__APOLLO_STATE__)
const defaultOptions = {
watchQuery: {
fetchPolicy: 'cache-and-network',
errorPolicy: 'all'
},
query: {
fetchPolicy: 'cache-and-network',
errorPolicy: 'all'
},
mutate: {
errorPolicy: 'all'
}
}
export const client = new ApolloClient({
link: ApolloLink.from([authRetryLink, authLink, httpLink]), // replaced link with httpLink
cache,
defaultOptions,
connectToDevTools: true
})