-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoverage.component.ts
More file actions
37 lines (28 loc) · 1.22 KB
/
overage.component.ts
File metadata and controls
37 lines (28 loc) · 1.22 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
35
36
37
import { Component, OnInit } from '@angular/core';
import { MsalService } from '@azure/msal-angular';
import { GraphService } from '../graph.service';
import { setGroupsInStorage } from '../utils/storage-utils';
import { groups } from '../auth-config';
@Component({
selector: 'app-overage',
templateUrl: './overage.component.html',
styleUrls: ['./overage.component.css']
})
export class OverageComponent implements OnInit {
requiredGroupsByApplication: string[] = [];
constructor(private authService: MsalService, private graphService: GraphService) { }
ngOnInit(): void {
this.getGroups();
}
async getGroups(): Promise<void> {
try {
// Filter out the required groups defined in auth-config.ts
this.requiredGroupsByApplication = await this.graphService.getFilteredGroups(Object.values(groups));
const activeAccount = this.authService.instance.getActiveAccount() || this.authService.instance.getAllAccounts()[0];
// Store the groups in session storage for this user
setGroupsInStorage(activeAccount, this.requiredGroupsByApplication);
} catch (error) {
console.log(error);
}
}
}