forked from eatvio/eatvio_app
feature(blogPosts): refactor main screen
This commit is contained in:
@@ -13,8 +13,14 @@ abstract class RegistrationService {
|
||||
@Body() required Map<String, dynamic> sheet,
|
||||
});
|
||||
|
||||
@GET('/api/locations')
|
||||
Future<LocationModel> getLocations({
|
||||
@GET('/api/location_by_address')
|
||||
Future<LocationModel> getLocationsByAddress({
|
||||
@Query('user_address') required String query,
|
||||
});
|
||||
|
||||
@GET('/api/api/location_by_coordinate')
|
||||
Future<LocationModel> getLocationsByCoordinate({
|
||||
@Query('coordinate[position][latitude]') required String latitude,
|
||||
@Query('coordinate[position][longitude]') required String longitude,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ class _RegistrationService implements RegistrationService {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<LocationModel> getLocations({required String query}) async {
|
||||
Future<LocationModel> getLocationsByAddress({required String query}) async {
|
||||
final _extra = <String, dynamic>{};
|
||||
final queryParameters = <String, dynamic>{r'user_address': query};
|
||||
final _headers = <String, dynamic>{};
|
||||
@@ -61,7 +61,40 @@ class _RegistrationService implements RegistrationService {
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/locations',
|
||||
'/api/location_by_address',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
))));
|
||||
final _value = LocationModel.fromJson(_result.data!);
|
||||
return _value;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<LocationModel> getLocationsByCoordinate({
|
||||
required String latitude,
|
||||
required String longitude,
|
||||
}) async {
|
||||
final _extra = <String, dynamic>{};
|
||||
final queryParameters = <String, dynamic>{
|
||||
r'coordinate[position][latitude]': latitude,
|
||||
r'coordinate[position][longitude]': longitude,
|
||||
};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _result = await _dio
|
||||
.fetch<Map<String, dynamic>>(_setStreamType<LocationModel>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/api/location_by_coordinate',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user