fix
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user