Header, Footer, FileUpload
This commit is contained in:
28
src/components/Header.tsx
Normal file
28
src/components/Header.tsx
Normal file
@ -0,0 +1,28 @@
|
||||
import React, { useContext } from 'react'
|
||||
import './Header.css';
|
||||
import {Axios, UserCtx, UserCtxT} from '../context/UserContext';
|
||||
|
||||
|
||||
function Header() {
|
||||
const {setUser} = useContext<UserCtxT | null>(UserCtx) as UserCtxT;
|
||||
const logOut = () =>
|
||||
{
|
||||
Axios.post('logout.php')
|
||||
.then((res) =>
|
||||
{
|
||||
console.log(res);
|
||||
})
|
||||
.catch((err) => console.error(err));
|
||||
|
||||
setUser(null);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='logout'>
|
||||
<div>Header</div>
|
||||
<button onClick={logOut}>Logout</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Header;
|
||||
Reference in New Issue
Block a user