29 lines
754 B
TypeScript
29 lines
754 B
TypeScript
import type {
|
|
IDriverRegistrationStatusPresenter,
|
|
DriverRegistrationStatusViewModel,
|
|
} from '@gridpilot/racing/application/presenters/IDriverRegistrationStatusPresenter';
|
|
|
|
export class DriverRegistrationStatusPresenter implements IDriverRegistrationStatusPresenter {
|
|
private viewModel: DriverRegistrationStatusViewModel | null = null;
|
|
|
|
present(
|
|
isRegistered: boolean,
|
|
raceId: string,
|
|
driverId: string
|
|
): DriverRegistrationStatusViewModel {
|
|
this.viewModel = {
|
|
isRegistered,
|
|
raceId,
|
|
driverId,
|
|
};
|
|
|
|
return this.viewModel;
|
|
}
|
|
|
|
getViewModel(): DriverRegistrationStatusViewModel {
|
|
if (!this.viewModel) {
|
|
throw new Error('Presenter has not been called yet');
|
|
}
|
|
return this.viewModel;
|
|
}
|
|
} |