mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
56 lines
2.3 KiB
TypeScript
56 lines
2.3 KiB
TypeScript
|
import React, { useState } from 'react';
|
||
|
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';
|
||
|
|
||
|
const App: React.FC = () => {
|
||
|
const [notification, setNotification] = useState(null as Notification | null);
|
||
|
return (
|
||
|
<NotificationsContext.Provider value={{ notification, setNotification }} >
|
||
|
<NotificationBar onClose={() => setNotification(null)} />
|
||
|
<Router>
|
||
|
<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 />
|
||
|
</Route>
|
||
|
<Route path="/">
|
||
|
<Redirect to={FirstFactorRoute}></Redirect>
|
||
|
</Route>
|
||
|
</Switch>
|
||
|
</Router>
|
||
|
</NotificationsContext.Provider>
|
||
|
);
|
||
|
}
|
||
|
|
||
|
export default App;
|