forked from finos/architecture-as-code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.tsx
More file actions
35 lines (30 loc) · 916 Bytes
/
index.tsx
File metadata and controls
35 lines (30 loc) · 916 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import './index.css';
import React from 'react';
import ReactDOM from 'react-dom/client';
import ProtectedRoute from './ProtectedRoute.js';
import { isAuthServiceEnabled, authService } from './authService.js';
import App from './App.js';
const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement);
const LogoutButton: React.FC = () => {
const handleLogout = async () => {
await authService.logout();
};
return (
<button onClick={handleLogout} style={{ position: 'absolute', top: 10, right: 10 }}>
Logout
</button>
);
};
const isAuthenticationEnabled = isAuthServiceEnabled();
root.render(
<React.StrictMode>
{isAuthenticationEnabled ? (
<ProtectedRoute>
<App />
<LogoutButton />
</ProtectedRoute>
) : (
<App />
)}
</React.StrictMode>
);