feat: add logout functionality and auto-logout on 401 responses
Add AUTH_EXPIRED_EVENT constant and dispatch event on 401 responses in API client, clearing stored token. Add handleLogout function to App component and wire up event listener to trigger logout on auth expiration. Pass onLogout prop to Layout component and add Logout button to topbar-actions. Update CSS to apply flex layout to topbar-actions and make responsive. Add backend hostname and network aliases in docker-compose to ensure consistent
This commit is contained in:
@@ -10,7 +10,11 @@ const items = [
|
||||
["Settings", "/settings"]
|
||||
];
|
||||
|
||||
export function Layout() {
|
||||
type LayoutProps = {
|
||||
onLogout: () => void;
|
||||
};
|
||||
|
||||
export function Layout({ onLogout }: LayoutProps) {
|
||||
return (
|
||||
<div className="shell">
|
||||
<aside className="sidebar">
|
||||
@@ -43,7 +47,12 @@ export function Layout() {
|
||||
<h2>Self-hosted VPN management</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div className="pill">Secure by design</div>
|
||||
<div className="topbar-actions">
|
||||
<div className="pill">Secure by design</div>
|
||||
<button className="ghost-button" onClick={onLogout} type="button">
|
||||
Logout
|
||||
</button>
|
||||
</div>
|
||||
</header>
|
||||
<Outlet />
|
||||
</main>
|
||||
|
||||
Reference in New Issue
Block a user