2020-06-21 20:40:37 +07:00
|
|
|
import React, { useState } from 'react';
|
2019-11-19 06:37:36 +07:00
|
|
|
import {
|
|
|
|
BrowserRouter as Router, Route, Switch, Redirect
|
|
|
|
} from "react-router-dom";
|
|
|
|
import ResetPasswordStep1 from './views/ResetPassword/ResetPasswordStep1';
|
|
|
|
import ResetPasswordStep2 from './views/ResetPassword/ResetPasswordStep2';
|
|
|
|
import RegisterSecurityKey from './views/DeviceRegistration/RegisterSecurityKey';
|
|
|
|
import RegisterOneTimePassword from './views/DeviceRegistration/RegisterOneTimePassword';
|
|
|
|
import {
|
|
|
|
FirstFactorRoute, ResetPasswordStep2Route,
|
|
|
|
ResetPasswordStep1Route, RegisterSecurityKeyRoute,
|
|
|
|
RegisterOneTimePasswordRoute,
|
|
|
|
LogoutRoute,
|
|
|
|
} from "./Routes";
|
|
|
|
import LoginPortal from './views/LoginPortal/LoginPortal';
|
|
|
|
import NotificationsContext from './hooks/NotificationsContext';
|
|
|
|
import { Notification } from './models/Notifications';
|
|
|
|
import NotificationBar from './components/NotificationBar';
|
|
|
|
import SignOut from './views/LoginPortal/SignOut/SignOut';
|
2020-07-01 14:16:08 +07:00
|
|
|
import { getRememberMe, getResetPassword } from './utils/Configuration';
|
2020-04-26 05:12:55 +07:00
|
|
|
import '@fortawesome/fontawesome-svg-core/styles.css'
|
2020-05-21 09:20:55 +07:00
|
|
|
import { config as faConfig } from '@fortawesome/fontawesome-svg-core';
|
2020-07-01 14:16:08 +07:00
|
|
|
import { getBasePath } from './utils/BasePath';
|
2020-04-26 05:12:55 +07:00
|
|
|
|
|
|
|
faConfig.autoAddCss = false;
|
2019-11-19 06:37:36 +07:00
|
|
|
|
|
|
|
const App: React.FC = () => {
|
|
|
|
const [notification, setNotification] = useState(null as Notification | null);
|
2019-12-07 23:40:42 +07:00
|
|
|
|
2019-11-19 06:37:36 +07:00
|
|
|
return (
|
|
|
|
<NotificationsContext.Provider value={{ notification, setNotification }} >
|
2020-07-01 14:16:08 +07:00
|
|
|
<Router basename={getBasePath()}>
|
2020-05-16 06:41:42 +07:00
|
|
|
<NotificationBar onClose={() => setNotification(null)} />
|
|
|
|
<Switch>
|
|
|
|
<Route path={ResetPasswordStep1Route} exact>
|
|
|
|
<ResetPasswordStep1 />
|
|
|
|
</Route>
|
|
|
|
<Route path={ResetPasswordStep2Route} exact>
|
|
|
|
<ResetPasswordStep2 />
|
|
|
|
</Route>
|
|
|
|
<Route path={RegisterSecurityKeyRoute} exact>
|
|
|
|
<RegisterSecurityKey />
|
|
|
|
</Route>
|
|
|
|
<Route path={RegisterOneTimePasswordRoute} exact>
|
|
|
|
<RegisterOneTimePassword />
|
|
|
|
</Route>
|
|
|
|
<Route path={LogoutRoute} exact>
|
|
|
|
<SignOut />
|
|
|
|
</Route>
|
|
|
|
<Route path={FirstFactorRoute}>
|
|
|
|
<LoginPortal
|
2020-07-01 14:16:08 +07:00
|
|
|
rememberMe={getRememberMe()}
|
|
|
|
resetPassword={getResetPassword()} />
|
2020-05-16 06:41:42 +07:00
|
|
|
</Route>
|
|
|
|
<Route path="/">
|
2020-05-21 09:20:55 +07:00
|
|
|
<Redirect to={FirstFactorRoute} />
|
2020-05-16 06:41:42 +07:00
|
|
|
</Route>
|
|
|
|
</Switch>
|
2019-11-19 06:37:36 +07:00
|
|
|
</Router>
|
|
|
|
</NotificationsContext.Provider>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default App;
|