Skip to content

Commit

Permalink
fix(profile): wrong page title after year change
Browse files Browse the repository at this point in the history
  • Loading branch information
esoadamo committed Jan 14, 2024
1 parent 2623a5e commit ad4702d
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@ 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',
templateUrl: './page-profile.component.html',
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<unknown>;

Expand Down Expand Up @@ -60,6 +61,7 @@ export class PageProfileComponent implements OnInit {
private modal: ModalService,
private achievement: AchievementService
) {
super();
}

ngOnInit(): void {
Expand Down Expand Up @@ -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;
}
Expand All @@ -290,14 +292,14 @@ 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],
achievement: achievement.id,
task: null
})])),
mergeMap(([user]) => this.users.cache.refresh(user.id))
).subscribe();
));
}
}

0 comments on commit ad4702d

Please sign in to comment.