Skip to content

Commit 56de837

Browse files
committed
fix(profile): wrong page title after year change
1 parent 05eb8e5 commit 56de837

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/app/components/profile/page-profile/page-profile.component.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,15 @@ import { BarValue } from 'ngx-bootstrap/progressbar/progressbar-type.interface';
1616
import { ROUTES } from '../../../../routes/routes';
1717
import { ProfileResponse, User } from '../../../../api/backend';
1818
import { TranslateService } from '@ngx-translate/core';
19+
import { SubscribedComponent } from '../../../util';
1920

2021
@Component({
2122
selector: 'ksi-page-profile',
2223
templateUrl: './page-profile.component.html',
2324
styleUrls: ['./page-profile.component.scss'],
2425
changeDetection: ChangeDetectionStrategy.OnPush
2526
})
26-
export class PageProfileComponent implements OnInit {
27+
export class PageProfileComponent extends SubscribedComponent implements OnInit {
2728
@ViewChild('modalDiploma', { static: true })
2829
modalDiploma: TemplateRef<unknown>;
2930

@@ -60,6 +61,7 @@ export class PageProfileComponent implements OnInit {
6061
private modal: ModalService,
6162
private achievement: AchievementService
6263
) {
64+
super();
6365
}
6466

6567
ngOnInit(): void {
@@ -274,10 +276,10 @@ export class PageProfileComponent implements OnInit {
274276
}
275277

276278
showDiploma(): void {
277-
this.user$.pipe(
279+
this.subscribe(this.user$.pipe(
278280
mergeMap((user) => this.diplomaService.userDiplomaURL(user)),
279-
take(1)
280-
).subscribe((diplomaURL) => {
281+
take(1)),
282+
(diplomaURL) => {
281283
if (diplomaURL === undefined) {
282284
return;
283285
}
@@ -290,14 +292,14 @@ export class PageProfileComponent implements OnInit {
290292

291293
grantSuccessfulTrophy(grantSuccessfulButton: HTMLButtonElement): void {
292294
grantSuccessfulButton.disabled = true;
293-
combineLatest([this.user$, this.achievement.getSpecialAchievement('successful')]).pipe(
295+
this.subscribe(combineLatest([this.user$, this.achievement.getSpecialAchievement('successful')]).pipe(
294296
take(1),
295297
mergeMap(([user, achievement]) => combineLatest([of(user), this.backend.http.adminAchievementsGrant({
296298
users: [user.id],
297299
achievement: achievement.id,
298300
task: null
299301
})])),
300302
mergeMap(([user]) => this.users.cache.refresh(user.id))
301-
).subscribe();
303+
));
302304
}
303305
}

0 commit comments

Comments
 (0)