Using apollo-fetch-upload instead of apollo-upload-client.
This commit is contained in:
parent
b63acd61de
commit
9f63dbc020
@ -1,5 +1,6 @@
|
||||
import { ApolloClient } from 'react-apollo'
|
||||
import { createNetworkInterface } from 'apollo-upload-client'
|
||||
import { createApolloFetchUpload } from 'apollo-fetch-upload'
|
||||
import { print } from 'graphql/language/printer'
|
||||
import 'isomorphic-fetch'
|
||||
|
||||
// Used in the browser to share a single Apollo Client instance between
|
||||
@ -11,14 +12,19 @@ let apolloClient = null
|
||||
* @param {Object} [initialState] - Apollo client Redux store initial state.
|
||||
* @returns {Object} Apollo Client instance.
|
||||
*/
|
||||
const createApolloClient = initialState =>
|
||||
new ApolloClient({
|
||||
function createApolloClient(initialState) {
|
||||
const apolloFetchUpload = createApolloFetchUpload({
|
||||
uri: process.env.API_URI
|
||||
})
|
||||
|
||||
return new ApolloClient({
|
||||
initialState,
|
||||
ssrMode: !process.browser,
|
||||
networkInterface: createNetworkInterface({
|
||||
uri: process.env.API_URI
|
||||
})
|
||||
networkInterface: {
|
||||
query: req => apolloFetchUpload({ ...req, query: print(req.query) })
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets or creates the Apollo Client instance.
|
||||
|
||||
18
app/package-lock.json
generated
18
app/package-lock.json
generated
@ -145,16 +145,6 @@
|
||||
"whatwg-fetch": "2.0.3"
|
||||
}
|
||||
},
|
||||
"apollo-upload-client": {
|
||||
"version": "5.1.0",
|
||||
"resolved": "https://registry.npmjs.org/apollo-upload-client/-/apollo-upload-client-5.1.0.tgz",
|
||||
"integrity": "sha512-qMZu9eOdJpcWHsX1T4/MAGRqf9D/WaNCL6AM4l3Cy20d0345xxxBU4K9dDMqQn7wRTIxoCKQE3jtjYe9CDfJzg==",
|
||||
"requires": {
|
||||
"apollo-client": "1.8.1",
|
||||
"babel-runtime": "6.23.0",
|
||||
"extract-files": "1.1.0"
|
||||
}
|
||||
},
|
||||
"argparse": {
|
||||
"version": "1.0.9",
|
||||
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.9.tgz",
|
||||
@ -2058,14 +2048,6 @@
|
||||
"is-extglob": "1.0.0"
|
||||
}
|
||||
},
|
||||
"extract-files": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/extract-files/-/extract-files-1.1.0.tgz",
|
||||
"integrity": "sha512-d/NURNN3NBGBBJvzlElkqGeStzDvobDL6jhwSShK5u6J075jioq8TVq3MhYYD+CzQBkX147Hk4tDOjkUI0gF9Q==",
|
||||
"requires": {
|
||||
"babel-runtime": "6.23.0"
|
||||
}
|
||||
},
|
||||
"fast-deep-equal": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz",
|
||||
|
||||
@ -2,8 +2,9 @@
|
||||
"name": "apollo-upload-examples-app",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"apollo-upload-client": "^5.1.0",
|
||||
"apollo-fetch-upload": "^1.0.0",
|
||||
"babel-plugin-transform-inline-environment-variables": "^0.1.1",
|
||||
"graphql": "^0.10.5",
|
||||
"next": "^3.0.1-beta.18",
|
||||
"react": "^15.6.1",
|
||||
"react-apollo": "^1.4.8",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user