diff --git a/docs/source/tutorial/local-state.mdx b/docs/source/tutorial/local-state.mdx index 1c9b7dfbf..27a95b180 100644 --- a/docs/source/tutorial/local-state.mdx +++ b/docs/source/tutorial/local-state.mdx @@ -85,7 +85,9 @@ const client: ApolloClient = new ApolloClient({ link: new HttpLink({ uri: 'http://localhost:4000/graphql', headers: { - authorization: localStorage.getItem('token'), + get authorization() { + return localStorage.getItem('token') + }, }, }), typeDefs, diff --git a/docs/source/tutorial/mutations.mdx b/docs/source/tutorial/mutations.mdx index e91060426..0dddeee0c 100644 --- a/docs/source/tutorial/mutations.mdx +++ b/docs/source/tutorial/mutations.mdx @@ -105,8 +105,10 @@ const client: ApolloClient = new ApolloClient({ link: new HttpLink({ uri: 'http://localhost:4000/graphql', headers: { - authorization: localStorage.getItem('token'), - }, + get authorization() { + return localStorage.getItem('token') + }, + }, }), }); @@ -123,7 +125,11 @@ cache.writeData({ const client = new ApolloClient({ cache, link: new HttpLink({ - headers: { authorization: localStorage.getItem('token') }, + headers: { + get authorization() { + return localStorage.getItem('token') + }, + }, uri: "http://localhost:4000/graphql", }), });