Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/dashboard/src/error-pages/ErrorPages.tsx
2499 views
1
/**
2
* Copyright (c) 2023 Gitpod GmbH. All rights reserved.
3
* Licensed under the GNU Affero General Public License (AGPL).
4
* See License.AGPL.txt in the project root for license information.
5
*/
6
7
import { FC, Suspense, lazy } from "react";
8
import { Route, Switch, useRouteMatch } from "react-router";
9
import { AppLoading } from "../app/AppLoading";
10
11
const ExpiredOTS = lazy(() => import("./ExpiredOTS"));
12
const DefaultError = lazy(() => import("./DefaultError"));
13
14
// Mounted under the `/error` path
15
// Intended to handle error pages we can redirect to w/ distinct urls
16
export const ErrorPages: FC = () => {
17
let match = useRouteMatch();
18
19
return (
20
<Suspense fallback={<AppLoading />}>
21
<Switch>
22
{/* Matching /error/expired-ots */}
23
<Route path={`${match.path}/expired-ots`} exact component={ExpiredOTS} />
24
{/* Matching any error/* routes */}
25
<Route path={match.path} component={DefaultError} />
26
</Switch>
27
</Suspense>
28
);
29
};
30
31