mirror of
https://github.com/marcopiovanello/yt-dlp-web-ui.git
synced 2026-07-25 06:54:30 +00:00
24 lines
626 B
TypeScript
24 lines
626 B
TypeScript
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>
|
|
)
|
|
} |