forked from eatvio/eatvio_app
feat(profile): add button for weight and circumferences
This commit is contained in:
@@ -18,15 +18,15 @@ abstract class ProfileService {
|
||||
Future<ProfileModel> getMyProfile();
|
||||
|
||||
@POST('/api/profile/addCircumference')
|
||||
Future<Map<String, Circumference>> addCircumference({
|
||||
Future<void> addCircumference({
|
||||
@Part(name: 'chest_circumference') required int chestCircumference,
|
||||
@Part(name: 'waist_circumference') required int waistCircumference,
|
||||
@Part(name: 'hip_circumference') required int hipCircumference,
|
||||
});
|
||||
|
||||
@POST('/api/profile/addWeight')
|
||||
Future<Map<String, ChartPointModel>> addWeight({
|
||||
@Part() required int weight,
|
||||
Future<void> addWeight({
|
||||
@Part() required double weight,
|
||||
});
|
||||
|
||||
@GET('/api/blogPosts/search_by_author/{slug}')
|
||||
|
||||
@@ -88,7 +88,7 @@ class _ProfileService implements ProfileService {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Map<String, Circumference>> addCircumference({
|
||||
Future<void> addCircumference({
|
||||
required int chestCircumference,
|
||||
required int waistCircumference,
|
||||
required int hipCircumference,
|
||||
@@ -109,7 +109,7 @@ class _ProfileService implements ProfileService {
|
||||
'hip_circumference',
|
||||
hipCircumference.toString(),
|
||||
));
|
||||
final _options = _setStreamType<Map<String, Circumference>>(Options(
|
||||
final _options = _setStreamType<void>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
@@ -125,20 +125,11 @@ class _ProfileService implements ProfileService {
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late Map<String, Circumference> _value;
|
||||
try {
|
||||
_value = _result.data!.map((k, dynamic v) =>
|
||||
MapEntry(k, Circumference.fromJson(v as Map<String, dynamic>)));
|
||||
} on Object catch (e, s) {
|
||||
errorLogger?.logError(e, s, _options);
|
||||
rethrow;
|
||||
}
|
||||
return _value;
|
||||
await _dio.fetch<void>(_options);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Map<String, ChartPointModel>> addWeight({required int weight}) async {
|
||||
Future<void> addWeight({required double weight}) async {
|
||||
final _extra = <String, dynamic>{};
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
@@ -147,7 +138,7 @@ class _ProfileService implements ProfileService {
|
||||
'weight',
|
||||
weight.toString(),
|
||||
));
|
||||
final _options = _setStreamType<Map<String, ChartPointModel>>(Options(
|
||||
final _options = _setStreamType<void>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
@@ -163,16 +154,7 @@ class _ProfileService implements ProfileService {
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late Map<String, ChartPointModel> _value;
|
||||
try {
|
||||
_value = _result.data!.map((k, dynamic v) =>
|
||||
MapEntry(k, ChartPointModel.fromJson(v as Map<String, dynamic>)));
|
||||
} on Object catch (e, s) {
|
||||
errorLogger?.logError(e, s, _options);
|
||||
rethrow;
|
||||
}
|
||||
return _value;
|
||||
await _dio.fetch<void>(_options);
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
Reference in New Issue
Block a user