2021-01-10 12:05:09 +05:30
|
|
|
import React,{Suspense, useState} from 'react';
|
2021-01-08 20:48:18 +05:30
|
|
|
import {Spin} from 'antd';
|
|
|
|
|
|
|
|
|
|
|
2021-01-10 12:05:09 +05:30
|
|
|
import { BrowserRouter as Router, Route, Switch, Redirect } from 'react-router-dom';
|
2021-01-08 20:48:18 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
const Signup = React.lazy(() => import('./Signup'));
|
|
|
|
|
const App = React.lazy(() => import('./App'));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const AppWrapper = () => {
|
|
|
|
|
|
2021-01-10 12:05:09 +05:30
|
|
|
const [isUserAuthenticated, setIsUserAuthenticated] = useState(false);
|
|
|
|
|
|
2021-01-08 20:48:18 +05:30
|
|
|
return(
|
|
|
|
|
|
|
|
|
|
<Router basename="/">
|
|
|
|
|
|
|
|
|
|
<Suspense fallback={<Spin size="large" />}>
|
|
|
|
|
<Switch>
|
|
|
|
|
<Route path="/signup" exact component={Signup} />
|
2021-01-10 12:05:09 +05:30
|
|
|
<Route path="/application" exact component={App} />
|
|
|
|
|
<Route path="/application/:servicename" component={App}/>
|
|
|
|
|
<Route path="/service-map" component={App}/>
|
|
|
|
|
<Route path="/traces" exact component={App}/>
|
|
|
|
|
<Route path="/traces/:id" component={App}/>
|
|
|
|
|
<Route path="/usage-explorer" component={App}/>
|
|
|
|
|
|
|
|
|
|
<Route path="/" exact
|
|
|
|
|
render={() => {
|
|
|
|
|
return (
|
|
|
|
|
localStorage.getItem('isLoggedIn')==='yes' ?
|
|
|
|
|
<Redirect to="/application" /> :
|
|
|
|
|
<Redirect to="/signup" />
|
|
|
|
|
)
|
|
|
|
|
}}
|
|
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
|
2021-01-08 20:48:18 +05:30
|
|
|
|
|
|
|
|
</Switch>
|
|
|
|
|
</Suspense>
|
|
|
|
|
|
|
|
|
|
</Router>
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default AppWrapper;
|