Tweaks to match the current Next.js API.

This commit is contained in:
Jayden Seric 2017-11-08 14:46:52 +11:00
parent f96e0b2633
commit 1799440d65

View File

@ -37,10 +37,10 @@ export default ComposedComponent =>
* when navigating to a different route via the Link component or using the * when navigating to a different route via the Link component or using the
* routing APIs. For either environment the initial props returned must be * routing APIs. For either environment the initial props returned must be
* serializable to JSON. * serializable to JSON.
* @see https://github.com/zeit/next.js/issues/978
* @see https://github.com/zeit/next.js/#fetching-data-and-component-lifecycle * @see https://github.com/zeit/next.js/#fetching-data-and-component-lifecycle
* @param {Object} context * @param {Object} context
* @param {String} context.pathname - Path section of the page URL. * @param {String} context.pathname - Page URL path.
* @param {String} context.asPath - Page URL path and query as shown in browser.
* @param {Object} context.query - Query string section of the page URL parsed as an object. * @param {Object} context.query - Query string section of the page URL parsed as an object.
* @param {Object} context.req - HTTP request (server only). * @param {Object} context.req - HTTP request (server only).
* @param {Object} context.res - HTTP response (server only). * @param {Object} context.res - HTTP response (server only).
@ -52,8 +52,9 @@ export default ComposedComponent =>
const initialProps = { const initialProps = {
composedComponentProps: { composedComponentProps: {
url: { url: {
query: context.query, pathname: context.pathname,
pathname: context.pathname asPath: context.asPath,
query: context.query
} }
} }
} }