mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-29 05:00:43 +10:00
Improve routing changes
- Add hash to saved from page - Use authPage instead of preferLogin for more flexibility
This commit is contained in:
parent
9027d07a84
commit
2b359caa0a
2 changed files with 4 additions and 5 deletions
|
|
@ -54,12 +54,11 @@ class RouteComponentRenderer extends Component {
|
|||
|
||||
render() {
|
||||
const { route, match, location, staticContext, flattenedRoutes } = this.props;
|
||||
const { component: RouteComponent, preferLogin = false } = route;
|
||||
const { component: RouteComponent, authPage = 'SignupPage' } = route;
|
||||
const canShow = this.canShowComponent();
|
||||
if (!canShow) {
|
||||
staticContext.forbidden = true;
|
||||
}
|
||||
const authPageName = preferLogin ? 'LoginPage' : 'SignupPage';
|
||||
return canShow
|
||||
? <RouteComponent
|
||||
params={match.params}
|
||||
|
|
@ -67,8 +66,8 @@ class RouteComponentRenderer extends Component {
|
|||
flattenedRoutes={flattenedRoutes}
|
||||
/>
|
||||
: <NamedRedirect
|
||||
name={authPageName}
|
||||
state={{ from: `${location.pathname}${location.search}` }}
|
||||
name={authPage}
|
||||
state={{ from: `${location.pathname}${location.search}${location.hash}` }}
|
||||
/>;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -309,7 +309,7 @@ const routesConfiguration = [
|
|||
{
|
||||
path: '/email_verification',
|
||||
auth: true,
|
||||
preferLogin: true,
|
||||
authPage: 'LoginPage',
|
||||
exact: true,
|
||||
name: 'EmailVerificationPage',
|
||||
component: props => <EmailVerificationPage {...props} />,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue