Stripped out a whole bunch of pages, read more

The purpose of this branch is to bring this project in line with the JWT
protcol that the microservice is using. For the time being, it's easier
to get a stripped-down and stable build and replace the lost parts, one-
by-one.
This commit is contained in:
2021-03-08 12:34:41 +11:00
parent e3e5af4af0
commit 7c09ac46da
46 changed files with 310 additions and 4150 deletions
+8 -16
View File
@@ -1,12 +1,12 @@
import React from 'react';
import { useCookies } from 'react-cookie';
import { Link } from 'react-router-dom';
const Visitor = () => {
return (
<div>
<a href='/signup'>Sign Up</a>
<Link to='/signup'>Sign Up</Link>
<em> - </em>
<a href='/login'>Log In</a>
<Link to='/login'>Log In</Link>
</div>
);
};
@@ -14,34 +14,26 @@ const Visitor = () => {
const Member = () => {
return (
<div>
<a href='/account'>Account</a>
<Link to='/account'>Account</Link>
<em> - </em>
<a href='/' onClick={logout}>Log out</a>
<Link to='/' onClick={logout}>Log out</Link>
</div>
);
};
const logout = async () => {
//TODO: update API
await fetch('/api/accounts/logout', { method: 'POST' })
.catch(e => console.error(e))
;
};
const Header = () => {
const [cookies, setCookie] = useCookies(['loggedin']);
let Options;
//check for logged in/out status
if (cookies['loggedin']) {
Options = Member;
} else {
Options = Visitor;
}
let Options = Visitor;
return (
<header>
<h1><a href='/'>MERN Template</a></h1>
<h1><Link to='/'>MERN Template</Link></h1>
<Options />
</header>
);