26 lines
609 B
TypeScript
26 lines
609 B
TypeScript
import type {
|
|
IGetPaymentsPresenter,
|
|
GetPaymentsResultDTO,
|
|
GetPaymentsViewModel,
|
|
} from '@gridpilot/payments/application/presenters/IGetPaymentsPresenter';
|
|
|
|
export class GetPaymentsPresenter implements IGetPaymentsPresenter {
|
|
private result: GetPaymentsViewModel | null = null;
|
|
|
|
reset() {
|
|
this.result = null;
|
|
}
|
|
|
|
present(dto: GetPaymentsResultDTO) {
|
|
this.result = dto;
|
|
}
|
|
|
|
getViewModel(): GetPaymentsViewModel | null {
|
|
return this.result;
|
|
}
|
|
|
|
get viewModel(): GetPaymentsViewModel {
|
|
if (!this.result) throw new Error('Presenter not presented');
|
|
return this.result;
|
|
}
|
|
} |