We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
resolve.js line 31:
const newContext = Object.assign({}, context, value);
The text was updated successfully, but these errors were encountered:
in the root route I want to do something like this:
export default { path: '/', children: [ require('./protected1').default, require('./protected2').default, require('./login').default, ], async action({ path, query, next }) { const route = await next(); if (path !== '/login' && !isAuthenticated()) { route.redirect = '/login'; } return route; } }
And I'm resolving it with:
const route = await UniversalRouter.resolve(routes, { path: req.path }); if (route.redirect) { res.redirect(route.status || 302, route.redirect); return; }
When navigating to http://mywebsite/login I was expecting path to be '/login' in the root route action, but it's always '/'.
As a workaround I'm passing additional _path property to the context and using that instead:
const route = await UniversalRouter.resolve(routes, { path: req.path, _path: req.path });
Sorry, something went wrong.
Since v3.0.0 you can use context.url instead of _path. More info about context see in docs.
context.url
_path
Successfully merging a pull request may close this issue.
resolve.js line 31:
const newContext = Object.assign({}, context, value);
The text was updated successfully, but these errors were encountered: