fix
This commit is contained in:
@@ -40,7 +40,6 @@ class SendPhotoBloc extends Bloc<SendPhotoEvent, SendPhotoState> {
|
||||
|
||||
switch (result) {
|
||||
case Success<List<int>>():
|
||||
// ✅ Защита: если data null или пустой — не вызываем finish
|
||||
if (result.data == null || result.data!.isEmpty) {
|
||||
emit(state.copyWith(
|
||||
status: SendPhotoStatus.failure,
|
||||
@@ -49,20 +48,19 @@ class SendPhotoBloc extends Bloc<SendPhotoEvent, SendPhotoState> {
|
||||
return;
|
||||
}
|
||||
|
||||
// ✅ Передаём два параметра в UseCase
|
||||
final finishResult = await _finishRideUsecase(
|
||||
event.orderId,
|
||||
result.data! // ✅ ! т.к. проверили выше
|
||||
result.data!
|
||||
);
|
||||
|
||||
switch (finishResult) {
|
||||
case Success<ScooterOrder>():
|
||||
case Success():
|
||||
emit(state.copyWith(
|
||||
status: SendPhotoStatus.success,
|
||||
recievedPhotoIds: result.data,
|
||||
));
|
||||
case Failure():
|
||||
print("❌ FINISH ERROR: ${finishResult.failure.message}");
|
||||
print("FINISH ERROR: ${finishResult.failure.message}");
|
||||
emit(state.copyWith(
|
||||
status: SendPhotoStatus.failure,
|
||||
errorMessage: 'Ошибка завершения поездки',
|
||||
|
||||
Reference in New Issue
Block a user