Added admin panel - this should complete all of the dummied out features

This commit is contained in:
2021-03-11 11:15:56 +11:00
parent b6e707d047
commit 34b6a25bb5
8 changed files with 778 additions and 2 deletions
+27
View File
@@ -0,0 +1,27 @@
import React, { useContext } from 'react';
import { Redirect } from 'react-router-dom';
import { TokenContext } from '../utilities/token-provider';
import NewsPublisher from '../panels/news-publisher';
import NewsEditor from '../panels/news-editor';
const Admin = props => {
//context
const authTokens = useContext(TokenContext);
//misplaced? (admin only)
if (!authTokens.accessToken || !authTokens.getPayload().privilege == 'administrator') {
return <Redirect to='/' />;
}
return (
<div className='page'>
<h1 className='centered'>Administration</h1>
<NewsPublisher />
<NewsEditor />
</div>
);
};
export default Admin;
+1 -1
View File
@@ -53,7 +53,7 @@ const LogIn = props => {
);
};
//DOCS: returns two values: response and OK
//DOCS: returns two values: err and authTokens
const handleSubmit = async (email, password) => {
email = email.trim(); //TODO: validate email on login