import React from 'react' import { useMsal } from '@azure/msal-react' import { FaUserCircle } from 'react-icons/fa' import styles from './SidebarUser.module.css' interface User { id: number; name: string; role: string; } interface SidebarUserProps { user: User; isLoading?: boolean; error?: string | null; } const SidebarUser: React.FC = ({ user, isLoading, error }) => { const { instance } = useMsal(); const handleLogout = async () => { try { // Clear MSAL cache and sign out await instance.logoutRedirect({ onRedirectNavigate: () => { // Clear any application-specific data from localStorage localStorage.clear(); return true; } }); } catch (error) { console.error('Logout failed:', error); } }; if (isLoading) { return
Lädt...
; } if (error) { return
Fehler beim Laden des Benutzerprofils
; } return (

{ user.name }

Rolle: {user.role}

) } export default SidebarUser;