Merge branch 'master' of github.com:ramonwenger/skillbox
This commit is contained in:
commit
732f857fa9
|
|
@ -1,6 +1,7 @@
|
||||||
import {InMemoryCache} from 'apollo-cache-inmemory/lib/index'
|
import {InMemoryCache} from 'apollo-cache-inmemory/lib/index'
|
||||||
import {HttpLink} from 'apollo-link-http/lib/index'
|
import {HttpLink} from 'apollo-link-http/lib/index'
|
||||||
import {ApolloClient} from 'apollo-client/index'
|
import {ApolloClient} from 'apollo-client/index'
|
||||||
|
import {ApolloLink} from 'apollo-link'
|
||||||
import fetch from 'unfetch'
|
import fetch from 'unfetch'
|
||||||
|
|
||||||
const httpLink = new HttpLink({
|
const httpLink = new HttpLink({
|
||||||
|
|
@ -12,10 +13,22 @@ const httpLink = new HttpLink({
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const consoleLink = new ApolloLink((operation, forward) => {
|
||||||
|
console.log(`starting request for ${operation.operationName}`);
|
||||||
|
|
||||||
|
return forward(operation).map((data) => {
|
||||||
|
console.log(`ending request for ${operation.operationName}`);
|
||||||
|
|
||||||
|
return data
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
const composedLink = ApolloLink.from([consoleLink, httpLink]);
|
||||||
|
|
||||||
// Create the apollo client
|
// Create the apollo client
|
||||||
export default new ApolloClient({
|
export default new ApolloClient({
|
||||||
// link: composedLink,
|
link: composedLink,
|
||||||
link: httpLink,
|
// link: httpLink,
|
||||||
cache: new InMemoryCache(),
|
cache: new InMemoryCache(),
|
||||||
connectToDevTools: true
|
connectToDevTools: true
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue