Skip to content

Commit

Permalink
[frontend] Fix the high level error for OTP
Browse files Browse the repository at this point in the history
  • Loading branch information
Kedae authored Jan 29, 2025
1 parent dd19ecf commit d27e61b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
25 changes: 11 additions & 14 deletions opencti-platform/opencti-front/src/app.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { BrowserRouter, Route, Routes, Navigate } from 'react-router-dom';
import React, { Suspense, lazy } from 'react';
import { HighLevelError, ErrorBoundary } from '@components/Error';
import { BrowserRouter, Navigate, Route, Routes } from 'react-router-dom';
import React, { lazy, Suspense } from 'react';
import { APP_BASE_PATH } from './relay/environment';
import { RedirectManager } from './components/RedirectManager';
import AuthBoundaryComponent from './private/components/AuthBoundary';
Expand All @@ -14,17 +13,15 @@ const App = () => (
<AuthBoundaryComponent>
<RedirectManager>
<Suspense fallback={<Loader />}>
<ErrorBoundary display={HighLevelError}>
<Routes>
<Route path="/dashboard/*" Component={PrivateRoot} />
<Route path="/public/*" Component={PublicRoot} />
{/* By default, redirect to dashboard */}
<Route
path="/*"
element={<Navigate to="/dashboard" replace={true} />}
/>
</Routes>
</ErrorBoundary>
<Routes>
<Route path="/dashboard/*" Component={PrivateRoot} />
<Route path="/public/*" Component={PublicRoot} />
{/* By default, redirect to dashboard */}
<Route
path="/*"
element={<Navigate to="/dashboard" replace={true} />}
/>
</Routes>
</Suspense>
</RedirectManager>
</AuthBoundaryComponent>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import { compose, includes, map } from 'ramda';
import * as PropTypes from 'prop-types';
import { HighLevelError } from './Error';
import LoginRoot from '../../public/LoginRoot';
import withRouter from '../../utils/compat_router/withRouter';

Expand Down Expand Up @@ -33,6 +34,7 @@ class AuthBoundaryComponent extends React.Component {
if (includes('OTP_REQUIRED', types)) {
return <LoginRoot type="2FA_VALIDATION" />;
}
return <HighLevelError />;
}
return this.props.children;
}
Expand Down

0 comments on commit d27e61b

Please sign in to comment.