Skip to content

Commit

Permalink
Simpler way to set the context.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaydenseric committed Nov 19, 2017
1 parent 5b5be29 commit 742bb12
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,8 @@ export const createUploadLink = (
} = {}
) =>
new ApolloLink(
operation =>
({ operationName, variables, query, extensions, getContext, setContext }) =>
new Observable(observer => {
const {
operationName,
variables,
query,
extensions,
getContext
} = operation

const requestOperation = {
operationName,
variables,
Expand Down Expand Up @@ -72,7 +64,7 @@ export const createUploadLink = (

linkFetch(uri, fetchOptions)
.then(response => {
operation.setContext({ response })
setContext({ response })
if (!response.ok)
throw new Error(`${response.status} (${response.statusText})`)
return response.json()
Expand Down

0 comments on commit 742bb12

Please sign in to comment.