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

30 lines
659 B
React
Raw Normal View History

2025-12-11 10:40:55 +01:00
/*
* Copyright (c) 2025 by Christian Kellner.
* Licensed under Apache-2.0 with Commons Clause and Attribution/Naming Clause
*/
import React from 'react';
2023-03-20 08:52:13 +01:00
import { Button } from '@douyinfe/semi-ui';
import { xhrPost } from '../../services/xhr';
2023-03-20 08:52:13 +01:00
import { IconUser } from '@douyinfe/semi-icons';
const Logout = function Logout({ text }) {
return (
<div>
<Button
icon={<IconUser />}
type="danger"
theme="solid"
onClick={async () => {
await xhrPost('/api/login/logout');
location.reload();
}}
>
{text && 'Logout'}
</Button>
</div>
);
};
export default Logout;