mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-01-23 02:35:14 +00:00
logout actually works now
This commit is contained in:
parent
8024c79dad
commit
23ce4b983e
1 changed files with 9 additions and 3 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import React from 'react';
|
||||
import { Link, useLocation } from 'react-router-dom';
|
||||
import { Link, useLocation, useNavigate } from 'react-router-dom';
|
||||
import {
|
||||
List,
|
||||
ListItem,
|
||||
|
|
@ -39,10 +39,16 @@ const items = [
|
|||
|
||||
const Sidebar = ({ open, miniDrawerWidth, drawerWidth, toggleDrawer }) => {
|
||||
const location = useLocation();
|
||||
const { isAuthenticated } = useAuthStore();
|
||||
const { isAuthenticated, logout } = useAuthStore();
|
||||
const {
|
||||
environment: { public_ip },
|
||||
} = useSettingsStore();
|
||||
const navigate = useNavigate();
|
||||
|
||||
const onLogout = () => {
|
||||
logout();
|
||||
navigate('/login');
|
||||
};
|
||||
|
||||
return (
|
||||
<Drawer
|
||||
|
|
@ -103,7 +109,7 @@ const Sidebar = ({ open, miniDrawerWidth, drawerWidth, toggleDrawer }) => {
|
|||
<Box sx={{ borderTop: '1px solid #ccc' }}>
|
||||
<List>
|
||||
<ListItem disablePadding>
|
||||
<ListItemButton>
|
||||
<ListItemButton onClick={onLogout}>
|
||||
<ListItemIcon>
|
||||
<LogoutIcon />
|
||||
</ListItemIcon>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue