File tree Expand file tree Collapse file tree
1-Authentication/1-sign-in-react/SPA/src/components Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { AuthenticatedTemplate , UnauthenticatedTemplate , useMsal } from '@azure/msal-react' ;
2- import { Navbar , Button , Dropdown , DropdownButton } from 'react-bootstrap' ;
2+ import { Navbar , Button } from 'react-bootstrap' ;
33import { loginRequest } from '../authConfig' ;
44
55export const NavigationBar = ( ) => {
66 const { instance } = useMsal ( ) ;
7-
8- let activeAccount ;
9-
10- if ( instance ) {
11- activeAccount = instance . getActiveAccount ( ) ;
12- }
13-
7+
148 const handleLoginRedirect = ( ) => {
159 instance . loginRedirect ( loginRequest ) . catch ( ( error ) => console . log ( error ) ) ;
1610 } ;
@@ -32,25 +26,17 @@ export const NavigationBar = () => {
3226 </ a >
3327 < AuthenticatedTemplate >
3428 < div className = "collapse navbar-collapse justify-content-end" >
35- < DropdownButton
36- variant = "warning"
37- drop = "start"
38- title = { activeAccount ? activeAccount . name : 'Unknown' }
39- >
40- < Dropdown . Item as = "button" onClick = { handleLogoutRedirect } >
41- Sign out
42- </ Dropdown . Item >
43- </ DropdownButton >
29+ < Button variant = "warning" onClick = { handleLogoutRedirect } >
30+ Sign out
31+ </ Button >
4432 </ div >
4533 </ AuthenticatedTemplate >
4634 < UnauthenticatedTemplate >
4735 < div className = "collapse navbar-collapse justify-content-end" >
48- < Button onClick = { handleLoginRedirect } >
49- Sign in
50- </ Button >
36+ < Button onClick = { handleLoginRedirect } > Sign in</ Button >
5137 </ div >
5238 </ UnauthenticatedTemplate >
5339 </ Navbar >
5440 </ >
5541 ) ;
56- } ;
42+ } ;
You can’t perform that action at this time.
0 commit comments