File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed
packages/smooth/src/server Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -8,10 +8,11 @@ import {
8
8
import { ValidateLink } from './links/validate'
9
9
import { createAPIClient } from '../api'
10
10
11
- export function getContext ( { req, config } ) {
12
- const lang = req . headers [ 'x-smooth-lang' ] || null
13
- const preview = Boolean ( req . headers [ 'x-smooth-preview' ] )
14
- const id = req . headers [ 'x-smooth-preview-id' ] || null
11
+ export function getContext ( { req, config, operationContext } ) {
12
+ const headers = operationContext ? operationContext . headers : req . headers
13
+ const lang = headers [ 'x-smooth-lang' ] || null
14
+ const preview = Boolean ( headers [ 'x-smooth-preview' ] )
15
+ const id = headers [ 'x-smooth-preview-id' ] || null
15
16
return {
16
17
api : createAPIClient ( { config, lang } ) ,
17
18
lang,
Original file line number Diff line number Diff line change @@ -95,7 +95,8 @@ export default function ssrMiddleware({
95
95
const apolloClient = createApolloClient ( {
96
96
schema,
97
97
fragmentTypes,
98
- context : getContext ( { req, config } ) ,
98
+ context : operation =>
99
+ getContext ( { req, config, operationContext : operation . getContext ( ) } ) ,
99
100
} )
100
101
101
102
let jsx = (
You can’t perform that action at this time.
0 commit comments