25 lines
789 B
TypeScript
25 lines
789 B
TypeScript
import { GetLeagueStandingsUseCase, LeagueStandingsViewModel } from '@gridpilot/core/league/application/use-cases/GetLeagueStandingsUseCase';
|
|
|
|
export interface ILeagueStandingsPresenter {
|
|
present(leagueId: string): Promise<void>;
|
|
getViewModel(): LeagueStandingsViewModel | null;
|
|
reset(): void;
|
|
}
|
|
|
|
export class LeagueStandingsPresenter implements ILeagueStandingsPresenter {
|
|
private viewModel: LeagueStandingsViewModel | null = null;
|
|
|
|
constructor(private getLeagueStandingsUseCase: GetLeagueStandingsUseCase) {}
|
|
|
|
reset(): void {
|
|
this.viewModel = null;
|
|
}
|
|
|
|
async present(leagueId: string): Promise<void> {
|
|
this.viewModel = await this.getLeagueStandingsUseCase.execute(leagueId);
|
|
}
|
|
|
|
getViewModel(): LeagueStandingsViewModel | null {
|
|
return this.viewModel;
|
|
}
|
|
} |