mirror of
https://github.com/Telecominfraproject/wlan-cloud-ucentralgw-ui.git
synced 2025-11-01 11:17:51 +00:00
27 lines
589 B
JavaScript
27 lines
589 B
JavaScript
import { useAuth } from 'ucentral-libs';
|
|
import { Route } from 'react-router-dom';
|
|
import React from 'react';
|
|
|
|
const TheLayout = React.lazy(() => import('layout'));
|
|
const Login = React.lazy(() => import('pages/LoginPage'));
|
|
|
|
const Routes = () => {
|
|
const { currentToken, endpoints } = useAuth();
|
|
|
|
return (
|
|
<Route
|
|
path="/"
|
|
name="Devices"
|
|
render={(props) =>
|
|
currentToken !== '' && Object.keys(endpoints).length !== 0 ? (
|
|
<TheLayout {...props} />
|
|
) : (
|
|
<Login {...props} />
|
|
)
|
|
}
|
|
/>
|
|
);
|
|
};
|
|
|
|
export default Routes;
|