diff --git a/frontend/src/components/layout/TopBar.tsx b/frontend/src/components/layout/TopBar.tsx index a773c52..f66c76d 100644 --- a/frontend/src/components/layout/TopBar.tsx +++ b/frontend/src/components/layout/TopBar.tsx @@ -1,6 +1,6 @@ import { useNavigate, useLocation } from 'react-router-dom' +import { useMsal } from '@azure/msal-react' import { useAuthStore } from '../../stores/useAuthStore' -import api from '../../api/client' const IconChevronLeft = () => ( @@ -13,17 +13,13 @@ export default function TopBar() { const logout = useAuthStore(s => s.logout) const navigate = useNavigate() const location = useLocation() + const { instance } = useMsal() - const handleLogout = async () => { - try { - const res = await api.post('/auth/logout', { redirectUri: window.location.origin + '/ac-helper/' }) - logout() - if (res.data.logoutUrl) window.location.href = res.data.logoutUrl - else navigate('/login') - } catch { - logout() - navigate('/login') - } + const handleLogout = () => { + // App-only logout: clear local token + MSAL cache, no Microsoft account signout + logout() + instance.clearCache() + navigate('/') } const isDashboard = location.pathname === '/'