refactor
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import type {
|
||||
IGetPrizesPresenter,
|
||||
GetPrizesResultDTO,
|
||||
GetPrizesViewModel,
|
||||
} from '@core/payments/application/presenters/IGetPrizesPresenter';
|
||||
|
||||
export class GetPrizesPresenter implements IGetPrizesPresenter {
|
||||
private result: GetPrizesViewModel | null = null;
|
||||
|
||||
reset() {
|
||||
this.result = null;
|
||||
}
|
||||
|
||||
present(dto: GetPrizesResultDTO) {
|
||||
this.result = dto;
|
||||
}
|
||||
|
||||
getViewModel(): GetPrizesViewModel | null {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
get viewModel(): GetPrizesViewModel {
|
||||
if (!this.result) throw new Error('Presenter not presented');
|
||||
return this.result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user