fix(frontend): run initial props for children components after getting the user

This commit is contained in:
sct
2020-09-18 01:03:04 +00:00
parent 9131254f33
commit fdf9f38776
11 changed files with 158 additions and 71 deletions

View File

@@ -19,8 +19,12 @@ MoviePage.getInitialProps = async (ctx) => {
const response = await axios.get<MovieDetailsType>(
`http://localhost:${process.env.PORT || 3000}/api/v1/movie/${
ctx.query.movieId
}?language=${cookies.locale}`,
{ headers: ctx.req ? { cookie: ctx.req.headers.cookie } : undefined }
}${cookies.locale ? `?language=${cookies.locale}` : ''}`,
{
headers: ctx.req?.headers?.cookie
? { cookie: ctx.req.headers.cookie }
: undefined,
}
);
return {