refactor
This commit is contained in:
@@ -5,22 +5,22 @@ import type {
|
||||
} from '@core/payments/application/presenters/ICreatePaymentPresenter';
|
||||
|
||||
export class CreatePaymentPresenter implements ICreatePaymentPresenter {
|
||||
private result: CreatePaymentViewModel | null = null;
|
||||
private responseModel: CreatePaymentViewModel | null = null;
|
||||
|
||||
reset() {
|
||||
this.result = null;
|
||||
this.responseModel = null;
|
||||
}
|
||||
|
||||
present(dto: CreatePaymentResultDTO) {
|
||||
this.result = dto;
|
||||
this.responseModel = dto;
|
||||
}
|
||||
|
||||
getViewModel(): CreatePaymentViewModel | null {
|
||||
return this.result;
|
||||
getResponseModel(): CreatePaymentViewModel | null {
|
||||
return this.responseModel;
|
||||
}
|
||||
|
||||
get viewModel(): CreatePaymentViewModel {
|
||||
if (!this.result) throw new Error('Presenter not presented');
|
||||
return this.result;
|
||||
get responseModel(): CreatePaymentViewModel {
|
||||
if (!this.responseModel) throw new Error('Presenter not presented');
|
||||
return this.responseModel;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user