Files
fredy/ui/src/components/logout/Logout.jsx

24 lines
613 B
React
Raw Normal View History

2025-12-11 10:40:55 +01:00
/*
* Copyright (c) 2026 by Christian Kellner.
2025-12-11 10:40:55 +01:00
* Licensed under Apache-2.0 with Commons Clause and Attribution/Naming Clause
*/
import { xhrPost } from '../../services/xhr';
2023-03-20 08:52:13 +01:00
import { IconUser } from '@douyinfe/semi-icons';
const Logout = function Logout({ text }) {
const handleLogout = async () => {
await xhrPost('/api/login/logout');
location.reload();
};
return (
<button className={`navigate__logout-btn${!text ? ' navigate__logout-btn--icon-only' : ''}`} onClick={handleLogout}>
<IconUser size="default" />
{text && 'Logout'}
</button>
);
};
export default Logout;