Skip to content

Commit 2c89fad

Browse files
committed
[CodeFactor] Apply fixes
1 parent d74daa1 commit 2c89fad

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

plugins/apollo-client-config.js

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,23 +35,25 @@ export const middleware = new ApolloLink((operation, forward) => {
3535
return forward(operation)
3636
})
3737

38-
export const afterware = new ApolloLink((operation, forward) => forward(operation).map((response) => {
39-
/**
40-
* Check for session header and update session in local storage accordingly.
41-
*/
42-
const context = operation.getContext()
43-
const {
44-
response: { headers },
45-
} = context
38+
export const afterware = new ApolloLink((operation, forward) =>
39+
forward(operation).map((response) => {
40+
/**
41+
* Check for session header and update session in local storage accordingly.
42+
*/
43+
const context = operation.getContext()
44+
const {
45+
response: { headers },
46+
} = context
4647

47-
const session =
48-
headers.get('woocommerce-session') || localStorage.getItem('woo-session')
48+
const session =
49+
headers.get('woocommerce-session') || localStorage.getItem('woo-session')
4950

50-
if (process.browser && session) {
51-
localStorage.setItem('woo-session', session)
52-
}
53-
return response
54-
}))
51+
if (process.browser && session) {
52+
localStorage.setItem('woo-session', session)
53+
}
54+
return response
55+
})
56+
)
5557

5658
export default function () {
5759
return {

0 commit comments

Comments
 (0)