Browse Source

fix Bug #7910

master
daivph 5 years ago
parent
commit
2daf6b6085
3 changed files with 9 additions and 6 deletions
  1. +1
    -1
      lib/data/api/rest_client.dart
  2. +1
    -1
      lib/data/api/rest_client.g.dart
  3. +7
    -4
      lib/data/repository/repository.dart

+ 1
- 1
lib/data/api/rest_client.dart View File

@GET("/api/tb-countries?page={page}&size={size}&&sort=name,ASC") @GET("/api/tb-countries?page={page}&size={size}&&sort=name,ASC")
Future<List<LocationUnit>> getCountries( Future<List<LocationUnit>> getCountries(
{@Path() int page = 0, {@Path() int page = 0,
@Path() int size = 20,
@Path() int size = 400,
@DioOptions() Options options}); @DioOptions() Options options});


@GET( @GET(

+ 1
- 1
lib/data/api/rest_client.g.dart View File

} }


@override @override
getCountries({page = 0, size = 20, options}) async {
getCountries({page = 0, size = 400, options}) async {
const _extra = <String, dynamic>{}; const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{}; final queryParameters = <String, dynamic>{};
queryParameters.removeWhere((k, v) => v == null); queryParameters.removeWhere((k, v) => v == null);

+ 7
- 4
lib/data/repository/repository.dart View File

{@required LocationType locationType, {@required LocationType locationType,
int filterId, int filterId,
int page = 0, int page = 0,
int size = 100}) {
int size = 500}) {
final client = RestClient(dio); final client = RestClient(dio);
var op = buildConfigurableCacheOptions( var op = buildConfigurableCacheOptions(
forceRefresh: true, maxAge: Duration(days: ConstCommon.kMaxAgeCache)); forceRefresh: true, maxAge: Duration(days: ConstCommon.kMaxAgeCache));
var response; var response;
switch (locationType) { switch (locationType) {
case LocationType.province: case LocationType.province:
response = client.getProvinces(filterId, options: op);
response =
client.getProvinces(filterId, options: op, page: page, size: size);
break; break;
case LocationType.district: case LocationType.district:
response = client.getDistricts(filterId, options: op);
response =
client.getDistricts(filterId, options: op, page: page, size: size);
break; break;
case LocationType.ward: case LocationType.ward:
response = client.getWards(filterId, options: op);
response =
client.getWards(filterId, options: op, page: page, size: size);
break; break;
default: default:
response = client.getCountries(); response = client.getCountries();

Loading…
Cancel
Save