Loader for what pages is to be displayed based on the state of cookie: logged_in. Either displays login page or fetchrequested.
This commit is contained in:
35
client/app/components/Admin.jsx
Normal file
35
client/app/components/Admin.jsx
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
./app/components/App.jsx
|
||||||
|
|
||||||
|
<FetchData url={"https://apollo.kevinmidboe.com/api/v1/plex/playing"} />
|
||||||
|
*/
|
||||||
|
import React from 'react';
|
||||||
|
import { Link } from 'react-router-dom'
|
||||||
|
|
||||||
|
import FetchData from './FetchData.js';
|
||||||
|
import ListStrays from './ListStrays.jsx';
|
||||||
|
|
||||||
|
import FetchRequested from './FetchRequested.jsx';
|
||||||
|
|
||||||
|
import LoginForm from './LoginForm/LoginForm.jsx';
|
||||||
|
import { Provider } from 'react-redux';
|
||||||
|
import store from './redux/store.jsx';
|
||||||
|
|
||||||
|
import { getCookie } from './Cookie.jsx';
|
||||||
|
|
||||||
|
|
||||||
|
function getLoginStatus() {
|
||||||
|
const logged_in = getCookie('logged_in');
|
||||||
|
if (logged_in) {
|
||||||
|
return <FetchRequested />
|
||||||
|
}
|
||||||
|
return <LoginForm />
|
||||||
|
}
|
||||||
|
|
||||||
|
const Admin = () => (
|
||||||
|
<Provider store={store}>
|
||||||
|
{ getLoginStatus() }
|
||||||
|
</Provider>
|
||||||
|
)
|
||||||
|
|
||||||
|
export default Admin
|
||||||
Reference in New Issue
Block a user