I want to use NextPageContext for all pages #12919
Answered
by
lfades
ryo-ryukalice
asked this question in
Help
-
Both English and Next.js are beginners. sorry. I want to refer to cookies on all pages. MyApp.getInitialProps = async (ctx: AppContext) => {
const token = parseCookies(ctx)['api_token']
// => Error: Argument of type 'AppContextType<Router>' is not assignable to parameter of type 'NextPageContext'.
store.dispatch(authSlice.actions.login({ token: token }))
const appProps = await App.getInitialProps(ctx)
return { ...appProps }
} Is there a way to access Cookies using |
Beta Was this translation helpful? Give feedback.
Answered by
lfades
May 15, 2020
Replies: 1 comment 1 reply
-
Try changing it to |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
ryo-ryukalice
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Try changing it to
parseCookies(ctx.ctx)['api_token']
?