Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

diegomendezp:update-api-routes-apollo-server-and-client-auth #11146

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ export function withApollo(PageComponent, { ssr = true } = {}) {
WithApollo.displayName = `withApollo(${displayName})`
}

if (ssr || PageComponent.getInitialProps) {
WithApollo.getInitialProps = async ctx => {
if (ssr || PageComponent.getStaticProps) {
WithApollo.getStaticProps = async ctx => {
const { AppTree } = ctx

// Initialize ApolloClient, add it to the ctx object so
Expand All @@ -47,10 +47,10 @@ export function withApollo(PageComponent, { ssr = true } = {}) {
req: ctx.req,
}))

// Run wrapped getInitialProps methods
// Run wrapped getStaticProps methods
let pageProps = {}
if (PageComponent.getInitialProps) {
pageProps = await PageComponent.getInitialProps(ctx)
if (PageComponent.getStaticProps) {
pageProps = await PageComponent.getStaticProps(ctx)
}

// Only on the server:
Expand Down