Add logout button to the sidebar menu for user session termination
Add a new 'LogOut' icon and a button to the sidebar navigation. The button, when clicked, triggers a redirect to the '/api/logout' endpoint, effectively ending the user's session. This is implemented in `client/src/components/app-sidebar.tsx`. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 99f0fce6-9386-489a-9632-1d81223cab44 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/6d543d2c-20b9-4ea6-93fe-70fe9b1d9f80/99f0fce6-9386-489a-9632-1d81223cab44/c7A8nZc
This commit is contained in:
parent
06c03be97c
commit
26ff61c947
4
.replit
4
.replit
@ -18,6 +18,10 @@ externalPort = 80
|
||||
localPort = 33035
|
||||
externalPort = 3001
|
||||
|
||||
[[ports]]
|
||||
localPort = 33349
|
||||
externalPort = 3002
|
||||
|
||||
[[ports]]
|
||||
localPort = 41343
|
||||
externalPort = 3000
|
||||
|
||||
@ -6,6 +6,7 @@ import {
|
||||
BarChart3,
|
||||
Bell,
|
||||
Settings,
|
||||
LogOut,
|
||||
} from "lucide-react";
|
||||
import { Link, useLocation } from "wouter";
|
||||
import {
|
||||
@ -108,7 +109,7 @@ export function AppSidebar() {
|
||||
</SidebarGroup>
|
||||
</SidebarContent>
|
||||
|
||||
<SidebarFooter className="p-4 border-t">
|
||||
<SidebarFooter className="p-4 border-t space-y-4">
|
||||
<div className="flex items-center justify-between gap-3">
|
||||
<div className="flex items-center gap-3 min-w-0">
|
||||
<Avatar className="h-8 w-8">
|
||||
@ -128,6 +129,19 @@ export function AppSidebar() {
|
||||
</div>
|
||||
<ThemeToggle />
|
||||
</div>
|
||||
|
||||
<div className="flex gap-2">
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className="flex-1"
|
||||
onClick={() => window.location.href = '/api/logout'}
|
||||
data-testid="button-logout"
|
||||
>
|
||||
<LogOut className="h-4 w-4 mr-2" />
|
||||
Esci
|
||||
</Button>
|
||||
</div>
|
||||
</SidebarFooter>
|
||||
</Sidebar>
|
||||
);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user