Created
August 19, 2018 16:56
-
-
Save giuseppeg/4ee67df54eabd26193e17b66f1d68229 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static async getInitialProps ({ Component, router, ctx }) { | |
let page = {} | |
if (Component.getInitialProps) { | |
page = await Component.getInitialProps(ctx) | |
} | |
const basepath = typeof window === 'undefined' | |
? '' | |
: location.pathname.slice(0, location.pathname.length - router.route.length).replace(/\/$/, '') | |
return { page, basepath } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment