forked from p34709852/monkey
Island UI: finish the routing implementation related to landing page (if mode not chosen redirect to landing page, etc.)
This commit is contained in:
parent
980f06ed73
commit
4dc138ca48
|
@ -97,7 +97,8 @@ class AppComponent extends AuthComponent {
|
|||
this.setState({completedSteps: res['completed_steps']});
|
||||
this.showInfectionDoneNotification();
|
||||
}
|
||||
});}
|
||||
});
|
||||
}
|
||||
)
|
||||
|
||||
}
|
||||
|
@ -115,9 +116,9 @@ class AppComponent extends AuthComponent {
|
|||
let render_func = () => {
|
||||
switch (this.state.isLoggedIn) {
|
||||
case true:
|
||||
if (this.state.islandMode === null && route_path !== Routes.LandingPage) {
|
||||
if (this.needsRedirectionToLandingPage(route_path)) {
|
||||
return <Redirect to={{pathname: Routes.LandingPage}}/>
|
||||
} else if(route_path === Routes.LandingPage && this.state.islandMode !== null){
|
||||
} else if (this.needsRedirectionToGettingStarted(route_path)) {
|
||||
return <Redirect to={{pathname: Routes.GettingStartedPage}}/>
|
||||
}
|
||||
return page_component;
|
||||
|
@ -142,6 +143,16 @@ class AppComponent extends AuthComponent {
|
|||
}
|
||||
};
|
||||
|
||||
needsRedirectionToLandingPage = (route_path) => {
|
||||
return (this.state.islandMode === null && route_path !== Routes.LandingPage)
|
||||
}
|
||||
|
||||
needsRedirectionToGettingStarted = (route_path) => {
|
||||
return route_path === Routes.LandingPage &&
|
||||
this.state.islandMode !== null &&
|
||||
this.state.islandMode !== undefined
|
||||
}
|
||||
|
||||
redirectTo = (userPath, targetPath) => {
|
||||
let pathQuery = new RegExp(userPath + '[/]?$', 'g');
|
||||
if (window.location.pathname.match(pathQuery)) {
|
||||
|
|
Loading…
Reference in New Issue