-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExample.tsx
More file actions
25 lines (23 loc) · 837 Bytes
/
Example.tsx
File metadata and controls
25 lines (23 loc) · 837 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
import React from 'react';
import ReactDOM from 'react-dom';
import { BrowserRouter as Router, Route, Switch, Redirect } from 'react-router-dom';
import { AuthRouter, AuthProvider, SecureRoute } from '../'; // this would be import from '@tag0/react-auth';
import exampleAuthOptions from './ExampleAuthOptions';
import './Example.css';
const App = () => {
const { securedRoute, authRoute } = exampleAuthOptions.options;
return (
<Router>
<AuthProvider {...exampleAuthOptions}>
<Switch>
<Route path={authRoute} component={AuthRouter} />
<SecureRoute exact path={securedRoute}>
<h1>User Home</h1>
</SecureRoute>
<Redirect to={securedRoute} />
</Switch>
</AuthProvider>
</Router>
);
};
ReactDOM.render(<App />, document.getElementById('root'));