Add Error Boundary for

- the Page component
- the Main component
This commit is contained in:
Mohamed Karray
2019-03-13 21:41:08 +01:00
parent 35c84c929a
commit 13e7ae24bd
5 changed files with 124 additions and 125 deletions

View File

@@ -9,7 +9,7 @@ import Users from "../users/containers/Users";
import Login from "../containers/Login";
import Logout from "../containers/Logout";
import { ProtectedRoute } from "@scm-manager/ui-components";
import {ErrorBoundary, ProtectedRoute} from "@scm-manager/ui-components";
import {binder, ExtensionPoint } from "@scm-manager/ui-extensions";
import AddUser from "../users/containers/AddUser";
@@ -38,97 +38,99 @@ class Main extends React.Component<Props> {
url = redirectUrlFactory(this.props);
}
return (
<div className="main">
<Switch>
<Redirect exact from="/" to={url}/>
<Route exact path="/login" component={Login} />
<Route path="/logout" component={Logout} />
<ProtectedRoute
exact
path="/repos"
component={Overview}
authenticated={authenticated}
/>
<ProtectedRoute
exact
path="/repos/create"
component={Create}
authenticated={authenticated}
/>
<ProtectedRoute
exact
path="/repos/:page"
component={Overview}
authenticated={authenticated}
/>
<ProtectedRoute
path="/repo/:namespace/:name"
component={RepositoryRoot}
authenticated={authenticated}
/>
<ProtectedRoute
exact
path="/users"
component={Users}
authenticated={authenticated}
/>
<ProtectedRoute
authenticated={authenticated}
path="/users/add"
component={AddUser}
/>
<ProtectedRoute
exact
path="/users/:page"
component={Users}
authenticated={authenticated}
/>
<ProtectedRoute
authenticated={authenticated}
path="/user/:name"
component={SingleUser}
/>
<ErrorBoundary>
<div className="main">
<Switch>
<Redirect exact from="/" to={url}/>
<Route exact path="/login" component={Login} />
<Route path="/logout" component={Logout} />
<ProtectedRoute
exact
path="/repos"
component={Overview}
authenticated={authenticated}
/>
<ProtectedRoute
exact
path="/repos/create"
component={Create}
authenticated={authenticated}
/>
<ProtectedRoute
exact
path="/repos/:page"
component={Overview}
authenticated={authenticated}
/>
<ProtectedRoute
path="/repo/:namespace/:name"
component={RepositoryRoot}
authenticated={authenticated}
/>
<ProtectedRoute
exact
path="/users"
component={Users}
authenticated={authenticated}
/>
<ProtectedRoute
authenticated={authenticated}
path="/users/add"
component={AddUser}
/>
<ProtectedRoute
exact
path="/users/:page"
component={Users}
authenticated={authenticated}
/>
<ProtectedRoute
authenticated={authenticated}
path="/user/:name"
component={SingleUser}
/>
<ProtectedRoute
exact
path="/groups"
component={Groups}
authenticated={authenticated}
/>
<ProtectedRoute
authenticated={authenticated}
path="/group/:name"
component={SingleGroup}
/>
<ProtectedRoute
authenticated={authenticated}
path="/groups/add"
component={AddGroup}
/>
<ProtectedRoute
exact
path="/groups/:page"
component={Groups}
authenticated={authenticated}
/>
<ProtectedRoute
path="/config"
component={Config}
authenticated={authenticated}
/>
<ProtectedRoute
path="/me"
component={Profile}
authenticated={authenticated}
/>
<ProtectedRoute
exact
path="/groups"
component={Groups}
authenticated={authenticated}
/>
<ProtectedRoute
authenticated={authenticated}
path="/group/:name"
component={SingleGroup}
/>
<ProtectedRoute
authenticated={authenticated}
path="/groups/add"
component={AddGroup}
/>
<ProtectedRoute
exact
path="/groups/:page"
component={Groups}
authenticated={authenticated}
/>
<ProtectedRoute
path="/config"
component={Config}
authenticated={authenticated}
/>
<ProtectedRoute
path="/me"
component={Profile}
authenticated={authenticated}
/>
<ExtensionPoint
name="main.route"
renderAll={true}
props={{authenticated, links}}
/>
</Switch>
</div>
<ExtensionPoint
name="main.route"
renderAll={true}
props={{authenticated, links}}
/>
</Switch>
</div>
</ErrorBoundary>
);
}
}