fix: await logout before navigating, prevent cancelled fetch

- Logout is now async — awaits sidecar /auth/logout before clearing tokens
- confirmSignOut awaits logout() before navigate('/login')
- 5 second timeout on logout fetch to prevent indefinite hang
- Added console.warn on logout failure

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-24 15:22:39 +05:30
parent d4f33d6c06
commit 13e81ba9fb
2 changed files with 13 additions and 8 deletions

View File

@@ -132,9 +132,9 @@ export const Sidebar = ({ activeUrl = "/" }: SidebarProps) => {
setLogoutOpen(true);
};
const confirmSignOut = () => {
const confirmSignOut = async () => {
setLogoutOpen(false);
logout();
await logout();
navigate('/login');
};