Skip to content

Commit 8bd99ed

Browse files
committed
🐛 Bug: Fixed request error format
1 parent 5824879 commit 8bd99ed

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/infrastructure/models/remote_error_model.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import '../../core/util/global_validation_map_function.dart';
22

33
class RemoteErrorModel {
4-
bool error;
4+
String error;
55
RemoteErrorModel({
66
required this.error,
77
});
@@ -10,13 +10,13 @@ class RemoteErrorModel {
1010
GlobalValidationMapFunction.checkMap(
1111
keys: ['erro'], map: map, className: 'RemoteErrorModel')
1212
? RemoteErrorModel(
13-
error: map['erro'] as bool,
13+
error: map['erro'] as String,
1414
)
1515
: RemoteErrorModel.empty();
1616

1717
factory RemoteErrorModel.empty() {
1818
return RemoteErrorModel(
19-
error: false,
19+
error: '',
2020
);
2121
}
2222

lib/infrastructure/provider/remote/datasource_impl.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class DatasourceImpl implements Datasource {
2525
Either<FailureRequest, HttpResponse> _handleResponse(HttpResponse response) {
2626
switch (response.statusCode) {
2727
case 200:
28-
return RemoteErrorModel.fromJson(response.data).error != false
28+
return RemoteErrorModel.fromJson(response.data).error.isNotEmpty
2929
? Left(FailureRequest.notFound('CEP not found'))
3030
: Right(response);
3131
case 201:

0 commit comments

Comments
 (0)