|
|
@@ -94,20 +94,31 @@ export default class Main extends Component<PropsType, StateType> {
|
|
|
}}
|
|
|
/>
|
|
|
<Route
|
|
|
- path={`/:subroute`}
|
|
|
+ exact
|
|
|
+ path="/"
|
|
|
+ render={() => {
|
|
|
+ if (this.state.isLoggedIn) {
|
|
|
+ return <Redirect to="/dashboard" />;
|
|
|
+ } else {
|
|
|
+ return <Redirect to="/login" />;
|
|
|
+ }
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ <Route
|
|
|
+ path={`/*`}
|
|
|
render={(routeProps) => {
|
|
|
- const urlRoute = routeProps.location.pathname.slice(1);
|
|
|
+ const baseRoute = routeProps.location.pathname.slice(1);
|
|
|
if (
|
|
|
this.state.isLoggedIn &&
|
|
|
this.state.initialized &&
|
|
|
- PorterUrls.includes(urlRoute)
|
|
|
+ PorterUrls.includes(baseRoute)
|
|
|
) {
|
|
|
return (
|
|
|
<Home
|
|
|
key="home"
|
|
|
currentProject={this.context.currentProject}
|
|
|
currentCluster={this.context.currentCluster}
|
|
|
- currentRoute={urlRoute as PorterUrl}
|
|
|
+ currentRoute={baseRoute as PorterUrl}
|
|
|
logOut={this.handleLogOut}
|
|
|
/>
|
|
|
);
|
|
|
@@ -116,16 +127,6 @@ export default class Main extends Component<PropsType, StateType> {
|
|
|
}
|
|
|
}}
|
|
|
/>
|
|
|
- <Route
|
|
|
- path="/"
|
|
|
- render={() => {
|
|
|
- if (this.state.isLoggedIn) {
|
|
|
- return <Redirect to="/dashboard" />;
|
|
|
- } else {
|
|
|
- return <Redirect to="/login" />;
|
|
|
- }
|
|
|
- }}
|
|
|
- />
|
|
|
</Switch>
|
|
|
);
|
|
|
};
|