This commit is contained in:
2026-07-08 13:09:20 +03:00
parent b9da1d3064
commit 9eda119527
42 changed files with 830 additions and 279 deletions

View File

@@ -22,7 +22,6 @@ class TopUpBloc extends Bloc<TopUpEvent, TopUpState> {
on<LoadTopUpData>((event, emit) async {
emit(state.copyWith(isLoading: true));
// Запускаем оба запроса параллельно
final results = await Future.wait([
getCertificatesUsecase(),
getUserCards(),
@@ -77,5 +76,21 @@ class TopUpBloc extends Bloc<TopUpEvent, TopUpState> {
on<ToggleAgreement>(
(event, emit) => emit(state.copyWith(isAgreed: event.value)),
);
on<TopUpButtonPressed>((event, emit) async {
emit(state.copyWith(isLoading: true));
if (state.isAgreed) {
final result = await purchaseCertificateUsecase(
certificateId: state.selectedTariff!.id,
cardId:state.selectedCard!.id,
);
if (result is Success) {
emit(state.copyWith(isLoading: false));
}
}
});
}
}