Skip to content

Commit e3f34f0

Browse files
authored
Merge pull request #4201 from prugit/patch-1
Part8d: Adding a token to a header. Replace setContext with SetContextLink in Apollo setup
2 parents 14e6642 + 7b7534e commit e3f34f0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/content/8/en/part8d.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,10 @@ After the backend changes, creating new persons requires that a valid user token
159159
```js
160160
import { ApolloClient, InMemoryCache, createHttpLink } from '@apollo/client' // highlight-line
161161
import { ApolloProvider } from '@apollo/client/react'
162-
import { setContext } from '@apollo/client/link/context' // highlight-line
162+
import { SetContextLink } from '@apollo/client/link/context' // highlight-line
163163

164164
// highlight-start
165-
const authLink = setContext((_, { headers }) => {
165+
const authLink = new SetContextLink(({ headers }) => {
166166
const token = localStorage.getItem('phonenumbers-user-token')
167167
return {
168168
headers: {

0 commit comments

Comments
 (0)