@@ -16,14 +16,15 @@ import { BarValue } from 'ngx-bootstrap/progressbar/progressbar-type.interface';
16
16
import { ROUTES } from '../../../../routes/routes' ;
17
17
import { ProfileResponse , User } from '../../../../api/backend' ;
18
18
import { TranslateService } from '@ngx-translate/core' ;
19
+ import { SubscribedComponent } from '../../../util' ;
19
20
20
21
@Component ( {
21
22
selector : 'ksi-page-profile' ,
22
23
templateUrl : './page-profile.component.html' ,
23
24
styleUrls : [ './page-profile.component.scss' ] ,
24
25
changeDetection : ChangeDetectionStrategy . OnPush
25
26
} )
26
- export class PageProfileComponent implements OnInit {
27
+ export class PageProfileComponent extends SubscribedComponent implements OnInit {
27
28
@ViewChild ( 'modalDiploma' , { static : true } )
28
29
modalDiploma : TemplateRef < unknown > ;
29
30
@@ -60,6 +61,7 @@ export class PageProfileComponent implements OnInit {
60
61
private modal : ModalService ,
61
62
private achievement : AchievementService
62
63
) {
64
+ super ( ) ;
63
65
}
64
66
65
67
ngOnInit ( ) : void {
@@ -274,10 +276,10 @@ export class PageProfileComponent implements OnInit {
274
276
}
275
277
276
278
showDiploma ( ) : void {
277
- this . user$ . pipe (
279
+ this . subscribe ( this . user$ . pipe (
278
280
mergeMap ( ( user ) => this . diplomaService . userDiplomaURL ( user ) ) ,
279
- take ( 1 )
280
- ) . subscribe ( ( diplomaURL ) => {
281
+ take ( 1 ) ) ,
282
+ ( diplomaURL ) => {
281
283
if ( diplomaURL === undefined ) {
282
284
return ;
283
285
}
@@ -290,14 +292,14 @@ export class PageProfileComponent implements OnInit {
290
292
291
293
grantSuccessfulTrophy ( grantSuccessfulButton : HTMLButtonElement ) : void {
292
294
grantSuccessfulButton . disabled = true ;
293
- combineLatest ( [ this . user$ , this . achievement . getSpecialAchievement ( 'successful' ) ] ) . pipe (
295
+ this . subscribe ( combineLatest ( [ this . user$ , this . achievement . getSpecialAchievement ( 'successful' ) ] ) . pipe (
294
296
take ( 1 ) ,
295
297
mergeMap ( ( [ user , achievement ] ) => combineLatest ( [ of ( user ) , this . backend . http . adminAchievementsGrant ( {
296
298
users : [ user . id ] ,
297
299
achievement : achievement . id ,
298
300
task : null
299
301
} ) ] ) ) ,
300
302
mergeMap ( ( [ user ] ) => this . users . cache . refresh ( user . id ) )
301
- ) . subscribe ( ) ;
303
+ ) ) ;
302
304
}
303
305
}
0 commit comments