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