sync changes

This commit is contained in:
2026-05-12 11:25:19 +03:00
parent 3616f84556
commit fdc5aefdd2
25 changed files with 313 additions and 152 deletions

View File

@@ -667,8 +667,22 @@ class ApiService {
return ScooterOrder.fromJson(response.data);
} on DioException catch (e) {
_handleDioError(e);
return null;
if (e.response?.statusCode == 400) {
final data = e.response?.data;
if (data is Map && data['message'] is List) {
final firstError = data['message'][0]['message'].toString();
if (firstError.contains("Wrong start zone")) {
throw WrongZoneException(message: "Некорректная зона для начала поездки.");
}
}
if (data is Map && data['message'] is String) {}
} else {
_handleDioError(e);
}
rethrow;
}
}
@@ -684,8 +698,22 @@ class ApiService {
}
return null;
} on DioException catch (e) {
_handleDioError(e);
return null;
if (e.response?.statusCode == 400) {
final data = e.response?.data;
if (data is Map && data['message'] is List) {
final firstError = data['message'][0]['message'].toString();
if (firstError.contains("Wrong start zone")) {
throw WrongZoneException(message: "Некорректная зона для начала поездки.");
}
}
if (data is Map && data['message'] is String) {}
} else {
_handleDioError(e);
}
rethrow;
}
}
@@ -762,8 +790,8 @@ class ApiService {
if (data is Map && data['message'] is List) {
final firstError = data['message'][0]['message'].toString();
if (firstError.contains("Wrong zone")) {
throw WrongZoneException(message: firstError);
if (firstError.contains("Wrong start zone")) {
throw WrongZoneException(message: "Некорректная зона для завершения поездки.");
}
}