fix
This commit is contained in:
@@ -2,9 +2,11 @@ import 'dart:async';
|
||||
|
||||
import 'package:be_happy/core/failures.dart';
|
||||
import 'package:be_happy/core/result.dart';
|
||||
import 'package:be_happy/presentation/viewmodel/splash_bloc.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
import '../../domain/usecase/verify_code_usecase.dart';
|
||||
import '../event/spalsh_event.dart';
|
||||
import '../event/verify_code_event.dart';
|
||||
import '../state/verify_code_state.dart';
|
||||
|
||||
@@ -21,11 +23,11 @@ import '../state/verify_code_state.dart';
|
||||
|
||||
class VerifyCodeBloc extends Bloc<VerifyCodeEvent, VerifyCodeState> {
|
||||
final VerifyCodeUseCase _verifyCodeUseCase;
|
||||
final LoginUseCase _loginUseCase; // 🔹 Добавляем поле для юзкейса логина
|
||||
final LoginUseCase _loginUseCase;
|
||||
final SplashBloc _splashBloc;
|
||||
Timer? _timer;
|
||||
|
||||
// 🔹 Обновляем конструктор
|
||||
VerifyCodeBloc(this._verifyCodeUseCase, this._loginUseCase)
|
||||
VerifyCodeBloc(this._verifyCodeUseCase, this._loginUseCase, this._splashBloc)
|
||||
: super(VerifyCodeState.initial()) {
|
||||
|
||||
on<VerifyCodeStarted>((event, emit) {
|
||||
@@ -96,12 +98,14 @@ class VerifyCodeBloc extends Bloc<VerifyCodeEvent, VerifyCodeState> {
|
||||
|
||||
emit(state.copyWith(isSubmitting: true, error: null));
|
||||
|
||||
// 🔹 Здесь автоматически подставится обновленный из стейта tempToken
|
||||
final result = await _verifyCodeUseCase.execute(state.code, state.tempToken);
|
||||
|
||||
final newState = switch (result) {
|
||||
Success() => (() {
|
||||
_timer?.cancel();
|
||||
|
||||
_splashBloc.add(AuthCheckRequested());
|
||||
|
||||
return state.copyWith(
|
||||
isSubmitting: false,
|
||||
isSuccess: true,
|
||||
|
||||
Reference in New Issue
Block a user