-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathuser-context.component.ts
More file actions
34 lines (30 loc) · 1.06 KB
/
user-context.component.ts
File metadata and controls
34 lines (30 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { Component, inject } from '@angular/core';
import { Router } from '@angular/router';
import {
SharedUserContextGuard,
SharedUserContextService,
} from '@backbase/shared/feature/user-context';
import { SelectContextModule } from '@backbase/select-context';
import { OAuthService } from 'angular-oauth2-oidc';
@Component({
selector: 'app-user-context',
templateUrl: './user-context.component.html',
imports: [SelectContextModule],
})
export default class UserContextComponent {
private readonly userContextService: SharedUserContextService = inject(
SharedUserContextService
);
private readonly userContextGuard: SharedUserContextGuard = inject(
SharedUserContextGuard
);
private readonly authService: OAuthService = inject(OAuthService);
private readonly router: Router = inject(Router);
selectContextSuccess(serviceAgreement: { id: string }) {
this.userContextService.setServiceAgreementId(serviceAgreement.id);
this.router.navigateByUrl(this.userContextGuard.getTargetUrl() || '');
}
logout() {
this.authService.logOut();
}
}