Newer
Older
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
38
import { Component, OnInit } from '@angular/core';
import { Injectable } from '@angular/core';
import { SearchService } from 'app/search/service/search-service';
import { AccountService } from 'app/core/auth/account.service';
import { Account } from 'app/core/user/account.model';
@Component({
selector: 'jhi-achievements',
templateUrl: './achievements.component.html',
styleUrls: ['./achievements.component.scss'],
})
@Injectable({ providedIn: 'root' })
export class AchievementsComponent implements OnInit {
account!: Account;
constructor(private accountService: AccountService, protected searchService: SearchService) {}
public getTotalNumberOfViews(): void {
// eslint-disable-next-line no-console
console.log('I have been called');
this.searchService.getStatisticsForUser(this.account.login).subscribe(
(data: number) => {
// eslint-disable-next-line no-console
console.log('Data: ' + data + ' for account ' + this.account.login);
},
() => alert('Could not load statistics for User')
);
}
ngOnInit(): void {
this.accountService.identity().subscribe(account => {
if (account) {
this.account = account;
}
});
}
}