Skip to content

Commit 446f333

Browse files
committed
feature: use the latest value of the local storage instead of the value from the closure
1 parent 11a475b commit 446f333

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

src/apollo.client.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,13 @@ export const createApolloClient = (httpUrl: string) => {
2929
},
3030
};
3131
});
32-
var accessToken = localStorage.getItem(ACCESS_TOKEN_KEY);
3332

3433
const wsLink = new GraphQLWsLink(
3534
createClient({
3635
url: wsUrl,
37-
connectionParams: accessToken
38-
? {
39-
authToken: accessToken,
40-
}
41-
: {},
36+
connectionParams: {
37+
authToken: localStorage.getItem(ACCESS_TOKEN_KEY),
38+
},
4239
})
4340
);
4441

0 commit comments

Comments
 (0)