Skip to content

Commit

Permalink
Fix userid for certs
Browse files Browse the repository at this point in the history
  • Loading branch information
sei-bstein committed Jan 22, 2025
1 parent 8fcdb0e commit 150cb8c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class GameCenterTeamContextMenuComponent {
this.observeTeamUrl = this.routerService.getObserveTeamsUrl(this.game.id, this.team.id);
}

this.certificateUrl = this.routerService.getCertificatePrintableUrl(PlayerMode.competition, this.game.id);
this.certificateUrl = this.routerService.getCertificatePrintableUrl(PlayerMode.competition, this.game.id, this.team.captain.userId);
}

protected confirmReset(request: TeamSessionResetRequest) {
Expand Down
8 changes: 4 additions & 4 deletions projects/gameboard-ui/src/app/services/router.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ export class RouterService implements OnDestroy {
return this.buildAppUrlWithQueryParams({ queryParams: { search: teamId } }, "admin", "game", gameId, "teams").toString();
}

public getCertificatePrintableUrl(mode: PlayerMode, challengeSpecOrGameId: string) {
const localUserId = this.localUser.user$.value?.id;
public getCertificatePrintableUrl(mode: PlayerMode, challengeSpecOrGameId: string, ownerUserId?: string) {
const userId = ownerUserId || this.localUser.user$.value?.id;

if (!localUserId) {
if (!userId) {
throw new Error("Can't navigate to printable certificate if not authenticated.");
}

return `user/${localUserId}/certificates/${mode}/${challengeSpecOrGameId}`;
return `user/${userId}/certificates/${mode}/${challengeSpecOrGameId}`;
}

public getCertificateListUrl() {
Expand Down

0 comments on commit 150cb8c

Please sign in to comment.