frontend performance, rpc/rest jwt authentication

This commit is contained in:
2023-06-22 11:31:24 +02:00
parent 78c1559e84
commit d6c0646756
24 changed files with 691 additions and 360 deletions

View File

@@ -0,0 +1,24 @@
import { ListItemButton, ListItemIcon, ListItemText } from '@mui/material'
import LogoutIcon from '@mui/icons-material/Logout'
import { getHttpEndpoint } from '../utils'
import { useNavigate } from 'react-router-dom'
export default function Logout() {
const navigate = useNavigate()
const logout = async () => {
const res = await fetch(`${getHttpEndpoint()}/auth/logout`)
if (res.ok) {
navigate('/login')
}
}
return (
<ListItemButton onClick={logout}>
<ListItemIcon>
<LogoutIcon />
</ListItemIcon>
<ListItemText primary="Authentication" />
</ListItemButton>
)
}