introduce a logout page and the navbar

This commit is contained in:
Sven Czarnian
2022-11-03 23:38:31 +01:00
parent 4506e2f4a1
commit 54b9b0245a
2 changed files with 163 additions and 0 deletions

22
src/components/logout.tsx Normal file
View File

@@ -0,0 +1,22 @@
import React, { useContext } from 'react';
import { useNavigate } from 'react-router-dom';
import { AuthContext } from '../contexts';
export const Logout: React.FC = () => {
const context = useContext(AuthContext);
const navigate = useNavigate();
context.setAuth({
valid: false,
user: {
vatsimId: '',
fullName: '',
administrator: false,
airportConfigurationAccess: [],
},
});
sessionStorage.removeItem('token');
navigate('/');
return <></>;
}