@@ -39,12 +39,14 @@ const Account = props => {
|
||||
<h1 className='centered'>Account</h1>
|
||||
<form className='constricted' onSubmit={async evt => {
|
||||
evt.preventDefault();
|
||||
const [err, result] = await update(passwordRef.current.value, retypeRef.current.value, contactRef.current.checked, authTokens.tokenFetch);
|
||||
const [err] = await update(passwordRef.current.value, retypeRef.current.value, contactRef.current.checked, authTokens.tokenFetch);
|
||||
|
||||
if (err) {
|
||||
alert(err);
|
||||
return;
|
||||
}
|
||||
|
||||
alert('Details updated');
|
||||
passwordRef.current.value = retypeRef.current.value = '';
|
||||
}}>
|
||||
<div>
|
||||
|
||||
@@ -11,7 +11,7 @@ const Admin = props => {
|
||||
const authTokens = useContext(TokenContext);
|
||||
|
||||
//misplaced? (admin only)
|
||||
if (!authTokens.accessToken || !authTokens.getPayload().privilege == 'administrator') {
|
||||
if (!authTokens.accessToken || authTokens.getPayload().privilege != 'administrator') {
|
||||
return <Redirect to='/' />;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ const Visitor = () => {
|
||||
return (
|
||||
<div>
|
||||
<Link to='/signup'>Sign Up</Link>
|
||||
<em> - </em>
|
||||
<span> - </span>
|
||||
<Link to='/login'>Log In</Link>
|
||||
</div>
|
||||
);
|
||||
@@ -19,7 +19,16 @@ const Member = () => {
|
||||
return (
|
||||
<div>
|
||||
<Link to='/account'>Account</Link>
|
||||
<em> - </em>
|
||||
<span> - </span>
|
||||
|
||||
{ authTokens.getPayload().privilege == 'administrator' ?
|
||||
<span>
|
||||
<Link to='/admin'>Admin</Link>
|
||||
<span> - </span>
|
||||
</span>:
|
||||
<span />
|
||||
}
|
||||
|
||||
{ /* Logout button logs you out of the server too */ }
|
||||
<Link to='/' onClick={async () => {
|
||||
const result = await authTokens.tokenFetch(`${process.env.AUTH_URI}/logout`, { //NOTE: this gets overwritten as a bugfix
|
||||
|
||||
Reference in New Issue
Block a user