21 lines
582 B
TypeScript
21 lines
582 B
TypeScript
import { ICreateLeaguePresenter, CreateLeagueResultDTO, CreateLeagueViewModel } from '@core/racing/application/presenters/ICreateLeaguePresenter';
|
|
|
|
export class CreateLeaguePresenter implements ICreateLeaguePresenter {
|
|
private result: CreateLeagueViewModel | null = null;
|
|
|
|
reset() {
|
|
this.result = null;
|
|
}
|
|
|
|
present(dto: CreateLeagueResultDTO): void {
|
|
this.result = {
|
|
leagueId: dto.leagueId,
|
|
success: true,
|
|
};
|
|
}
|
|
|
|
getViewModel(): CreateLeagueViewModel {
|
|
if (!this.result) throw new Error('Presenter not presented');
|
|
return this.result;
|
|
}
|
|
} |