Integrate router

This commit is contained in:
2021-05-12 18:16:15 +02:00
parent cd7cc0e5e4
commit 742eca4dbc
4 changed files with 128 additions and 5 deletions

View File

@@ -0,0 +1,17 @@
/**
* Main route
*
* @author Pierre Hubert
*/
import { Route, BrowserRouter as Router, Switch } from "react-router-dom";
export function MainRoute() {
return (
<Router>
<Switch>
<Route path="*">Not found</Route>
</Switch>
</Router>
);
}

View File

@@ -7,6 +7,7 @@
import React from "react";
import { AccountHelper } from "../../helpers/AccountHelper";
import { LoginRoute } from "../routes/LoginRoute";
import { MainRoute } from "../routes/MainRoute";
import { AsyncWidget } from "./AsyncWidget";
interface InitWidgetState {
@@ -45,10 +46,6 @@ export class InitWidget extends React.Component<{}, InitWidgetState> {
}
build() {
return this.state.signedIn ? (
<div>{AccountHelper.currentAccount.name}</div>
) : (
<LoginRoute></LoginRoute>
);
return this.state.signedIn ? <MainRoute /> : <LoginRoute></LoginRoute>;
}
}