website refactor
This commit is contained in:
@@ -777,7 +777,14 @@ export class LeagueService {
|
||||
throw new Error(fullConfigResult.unwrapErr().code);
|
||||
}
|
||||
|
||||
await this.getLeagueOwnerSummaryUseCase.execute({ leagueId });
|
||||
// Present the full config result
|
||||
this.leagueConfigPresenter.present(fullConfigResult.unwrap());
|
||||
|
||||
const ownerSummaryResult = await this.getLeagueOwnerSummaryUseCase.execute({ leagueId });
|
||||
if (ownerSummaryResult.isErr()) {
|
||||
throw new Error(ownerSummaryResult.unwrapErr().code);
|
||||
}
|
||||
this.getLeagueOwnerSummaryPresenter.present(ownerSummaryResult.unwrap());
|
||||
const ownerSummary = this.getLeagueOwnerSummaryPresenter.getViewModel()!;
|
||||
|
||||
const configForm = this.leagueConfigPresenter.getViewModel();
|
||||
|
||||
@@ -113,7 +113,7 @@ export const RaceProviders: Provider[] = [
|
||||
{
|
||||
provide: RACE_DETAIL_PRESENTER_TOKEN,
|
||||
useFactory: (driverRatingProvider: DriverRatingProvider, imageService: InMemoryImageServiceAdapter) =>
|
||||
new RaceDetailPresenter(driverRatingProvider, imageService, { raceId: '', driverId: '' }),
|
||||
new RaceDetailPresenter(driverRatingProvider, imageService),
|
||||
inject: [DRIVER_RATING_PROVIDER_TOKEN, IMAGE_SERVICE_TOKEN],
|
||||
},
|
||||
{
|
||||
|
||||
@@ -166,7 +166,7 @@ export class RaceService {
|
||||
}
|
||||
|
||||
const value = result.unwrap();
|
||||
this.raceDetailPresenter.present(value);
|
||||
this.raceDetailPresenter.present(value, params);
|
||||
return this.raceDetailPresenter;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,19 +13,20 @@ export type GetRaceDetailResponseModel = RaceDetailDTO;
|
||||
|
||||
export class RaceDetailPresenter {
|
||||
private result: GetRaceDetailResult | null = null;
|
||||
private params: GetRaceDetailParamsDTO | null = null;
|
||||
|
||||
constructor(
|
||||
private readonly driverRatingProvider: DriverRatingProvider,
|
||||
private readonly imageService: ImageServicePort,
|
||||
private readonly params: GetRaceDetailParamsDTO,
|
||||
) {}
|
||||
|
||||
present(result: GetRaceDetailResult): void {
|
||||
present(result: GetRaceDetailResult, params: GetRaceDetailParamsDTO): void {
|
||||
this.result = result;
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
async getResponseModel(): Promise<GetRaceDetailResponseModel | null> {
|
||||
if (!this.result) {
|
||||
if (!this.result || !this.params) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user