Last active
October 4, 2021 11:25
-
-
Save ziedHamdi/2c60bdd96ed3ccc4a7bd1146e02cea05 to your computer and use it in GitHub Desktop.
implementation of getServerSideProps in pages/xyz.js files
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
export async function getServerSideProps(context) { | |
const session = await getSession(context) | |
const client = initializeApollo({}) | |
//await getDataFromTree(Index) replaced by manual client.query calls | |
const cpl = await client.query({ | |
query: ComplaintsQuery, context: { | |
headers: {'infra-token': session?.infraToken} | |
} | |
}) | |
//... | |
return {props: {session, ...(documentProps.props), fullUrl}} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment