open5gs/webui/pages/index.js

26 lines
528 B
JavaScript
Raw Normal View History

import PropTypes from 'prop-types';
2017-05-24 01:07:56 +00:00
import withSession from '../lib/with-session';
import Login from '../components/Login';
2017-05-25 08:11:47 +00:00
import Layout from '../components/Layout';
2017-05-24 01:07:56 +00:00
const Restricted = (Component) => {
const checkAuth = (props) => {
return props.isLoggedIn ? <Component {...props} /> : <Login/>
2017-05-24 01:07:56 +00:00
}
return withSession(checkAuth);
}
2017-05-25 08:11:47 +00:00
const Index = Restricted(({session}) => (
<div>
<Layout session={session} />
</div>
2017-05-24 01:07:56 +00:00
)
2017-05-25 08:11:47 +00:00
)
2017-05-24 01:07:56 +00:00
Index.propTypes = {
session: PropTypes.object.isRequired
};
2017-05-24 01:07:56 +00:00
export default Index;