From ad4702d546e50258236ab2373a9219c5a7eeb929 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Hlav=C3=A1=C4=8Dek?= Date: Sun, 14 Jan 2024 18:48:17 +0100 Subject: [PATCH] fix(profile): wrong page title after year change --- .../profile/page-profile/page-profile.component.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/app/components/profile/page-profile/page-profile.component.ts b/src/app/components/profile/page-profile/page-profile.component.ts index 29900a1..24e059e 100644 --- a/src/app/components/profile/page-profile/page-profile.component.ts +++ b/src/app/components/profile/page-profile/page-profile.component.ts @@ -16,6 +16,7 @@ import { BarValue } from 'ngx-bootstrap/progressbar/progressbar-type.interface'; import { ROUTES } from '../../../../routes/routes'; import { ProfileResponse, User } from '../../../../api/backend'; import { TranslateService } from '@ngx-translate/core'; +import { SubscribedComponent } from '../../../util'; @Component({ selector: 'ksi-page-profile', @@ -23,7 +24,7 @@ import { TranslateService } from '@ngx-translate/core'; styleUrls: ['./page-profile.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush }) -export class PageProfileComponent implements OnInit { +export class PageProfileComponent extends SubscribedComponent implements OnInit { @ViewChild('modalDiploma', { static: true }) modalDiploma: TemplateRef; @@ -60,6 +61,7 @@ export class PageProfileComponent implements OnInit { private modal: ModalService, private achievement: AchievementService ) { + super(); } ngOnInit(): void { @@ -274,10 +276,10 @@ export class PageProfileComponent implements OnInit { } showDiploma(): void { - this.user$.pipe( + this.subscribe(this.user$.pipe( mergeMap((user) => this.diplomaService.userDiplomaURL(user)), - take(1) - ).subscribe((diplomaURL) => { + take(1)), + (diplomaURL) => { if (diplomaURL === undefined) { return; } @@ -290,7 +292,7 @@ export class PageProfileComponent implements OnInit { grantSuccessfulTrophy(grantSuccessfulButton: HTMLButtonElement): void { grantSuccessfulButton.disabled = true; - combineLatest([this.user$, this.achievement.getSpecialAchievement('successful')]).pipe( + this.subscribe(combineLatest([this.user$, this.achievement.getSpecialAchievement('successful')]).pipe( take(1), mergeMap(([user, achievement]) => combineLatest([of(user), this.backend.http.adminAchievementsGrant({ users: [user.id], @@ -298,6 +300,6 @@ export class PageProfileComponent implements OnInit { task: null })])), mergeMap(([user]) => this.users.cache.refresh(user.id)) - ).subscribe(); + )); } }