Skip to content

Commit

Permalink
Fixed the oauth issue
Browse files Browse the repository at this point in the history
  • Loading branch information
keshavsingh4522 committed Aug 13, 2024
1 parent 9daa7ea commit fb1ebde
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 18 deletions.
9 changes: 2 additions & 7 deletions src/app/components/general/header/header.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,8 @@
<img src="https://avatars3.githubusercontent.com/keshavsingh4522?size=400" height="22" alt="Profile image"
class="profileImg" />
</a>
<a class="nav-link" *ngIf="!loginDisplay" [routerLink]="['/setting']" (click)="toggleNavbar()">Settings</a>
<a class="nav-link" *ngIf="loginDisplay" [routerLink]="['/']"
(click)="logout(); toggleNavbar()">Logout</a>
<a class="nav-link" *ngIf="!loginDisplay"
[routerLink]="['/authentication/login']" (click)="toggleNavbar()">Login</a>
<a class="nav-link" *ngIf="loginDisplay"
[routerLink]="['/authentication/signup']" (click)="toggleNavbar()">Logout</a>
<a class="nav-link" href="#" *ngIf="!loginDisplay" (click)="login('en')"><span class="glyphicon glyphicon-log-in"></span> Login</a>
<a class="nav-link" href="#" *ngIf="loginDisplay" (click)="logout()"><span class="glyphicon glyphicon-log-out"></span> Logout</a>
</div>
</div>
</div>
Expand Down
22 changes: 11 additions & 11 deletions src/app/components/general/header/header.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,17 @@ export class HeaderComponent implements OnInit, OnDestroy {
@Inject(MSAL_GUARD_CONFIG) private msalGuardConfig: MsalGuardConfiguration, private authService: MsalService,
private msalBroadcastService: MsalBroadcastService
) {
this.msalBroadcastService.msalSubject$.subscribe((event: EventMessage) => {
if (event.eventType === EventType.LOGIN_SUCCESS) {
console.log('Login success:', event);
} else if (event.eventType === EventType.LOGIN_FAILURE) {
console.error('Login failure:', event);
} else if (event.eventType === EventType.ACQUIRE_TOKEN_SUCCESS) {
console.log('Token acquired:', event);
} else if (event.eventType === EventType.ACQUIRE_TOKEN_FAILURE) {
console.error('Token acquisition failed:', event);
}
});
// this.msalBroadcastService.msalSubject$.subscribe((event: EventMessage) => {
// if (event.eventType === EventType.LOGIN_SUCCESS) {
// console.log('Login success:', event);
// } else if (event.eventType === EventType.LOGIN_FAILURE) {
// console.error('Login failure:', event);
// } else if (event.eventType === EventType.ACQUIRE_TOKEN_SUCCESS) {
// console.log('Token acquired:', event);
// } else if (event.eventType === EventType.ACQUIRE_TOKEN_FAILURE) {
// console.error('Token acquisition failed:', event);
// }
// });
}
ngOnInit(): void {
console.log('navbar page loaded');
Expand Down

0 comments on commit fb1ebde

Please sign in to comment.