sync changes
This commit is contained in:
@@ -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: "Некорректная зона для завершения поездки.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user