Files
MERN-template/client/components/panels/header.jsx
T
Ratstail91 7c09ac46da 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.
2021-03-08 12:34:41 +11:00

43 lines
694 B
React

import React from 'react';
import { Link } from 'react-router-dom';
const Visitor = () => {
return (
<div>
<Link to='/signup'>Sign Up</Link>
<em> - </em>
<Link to='/login'>Log In</Link>
</div>
);
};
const Member = () => {
return (
<div>
<Link to='/account'>Account</Link>
<em> - </em>
<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 = () => {
let Options = Visitor;
return (
<header>
<h1><Link to='/'>MERN Template</Link></h1>
<Options />
</header>
);
};
export default Header;