mirror of
https://github.com/balzack/databag.git
synced 2025-02-14 12:39:17 +00:00
adding admin signout
This commit is contained in:
parent
29e93e494d
commit
172d28f0be
@ -44,7 +44,7 @@ export function Admin() {
|
||||
|
||||
return (
|
||||
<AdminWrapper>
|
||||
<Dashboard token={state.token} config={state.config} />
|
||||
<Dashboard token={state.token} config={state.config} logout={() => actions.logout()} />
|
||||
</AdminWrapper>
|
||||
)
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { DashboardWrapper, SettingsButton, AddButton, SettingsLayout } from './Dashboard.styled';
|
||||
import { Button, Modal, Input, InputNumber, Space, List } from 'antd';
|
||||
import { SettingOutlined, UserAddOutlined, ReloadOutlined } from '@ant-design/icons';
|
||||
import { SettingOutlined, UserAddOutlined, LogoutOutlined, ReloadOutlined } from '@ant-design/icons';
|
||||
import { useDashboard } from './useDashboard.hook';
|
||||
import { AccountItem } from './AccountItem/AccountItem';
|
||||
|
||||
export function Dashboard({ token, config }) {
|
||||
export function Dashboard({ token, config, logout }) {
|
||||
|
||||
const { state, actions } = useDashboard(token, config);
|
||||
|
||||
@ -22,6 +22,10 @@ export function Dashboard({ token, config }) {
|
||||
<SettingsButton type="text" size="small" icon={<SettingOutlined />}
|
||||
onClick={() => actions.setShowSettings(true)}></SettingsButton>
|
||||
</div>
|
||||
<div class="settings">
|
||||
<SettingsButton type="text" size="small" icon={<LogoutOutlined />}
|
||||
onClick={() => logout()}></SettingsButton>
|
||||
</div>
|
||||
<div class="add">
|
||||
<AddButton type="text" size="large" icon={<UserAddOutlined />}></AddButton>
|
||||
</div>
|
||||
|
@ -62,7 +62,10 @@ export function useAdmin() {
|
||||
},
|
||||
onUser: () => {
|
||||
navigate('/login');
|
||||
}
|
||||
},
|
||||
logout: () => {
|
||||
updateState({ access: null, token: null });
|
||||
},
|
||||
};
|
||||
|
||||
return { state, actions };
|
||||
|
Loading…
Reference in New Issue
Block a user