28 lines
603 B
React
28 lines
603 B
React
|
|
import { api } from '../../api/client';
|
||
|
|
|
||
|
|
export default function Logout({ onLogout }) {
|
||
|
|
const handleLogout = async () => {
|
||
|
|
api.logout();
|
||
|
|
if (onLogout) {
|
||
|
|
onLogout();
|
||
|
|
}
|
||
|
|
// Seite neu laden um sicherzustellen dass der User ausgeloggt ist
|
||
|
|
window.location.reload();
|
||
|
|
};
|
||
|
|
return (
|
||
|
|
<button onClick={handleLogout} style={{
|
||
|
|
margin: 8,
|
||
|
|
padding: '10px 20px',
|
||
|
|
background: '#d32f2f',
|
||
|
|
color: '#fff',
|
||
|
|
border: 'none',
|
||
|
|
borderRadius: 6,
|
||
|
|
cursor: 'pointer',
|
||
|
|
fontWeight: 600,
|
||
|
|
fontSize: 14
|
||
|
|
}}>
|
||
|
|
Logout
|
||
|
|
</button>
|
||
|
|
);
|
||
|
|
}
|