forked from eatvio/eatvio_app
diet creation scrren is done
This commit is contained in:
@@ -63,6 +63,18 @@ abstract class FeedService {
|
||||
@Part() int? parentCommentId,
|
||||
});
|
||||
|
||||
@GET('/api/plans/{slug}/comments/show')
|
||||
Future<CommentModel> getPlansComments({
|
||||
@Path() required String slug,
|
||||
});
|
||||
|
||||
@POST('/api/plans/{slug}/comment/create')
|
||||
Future<void> sendPlansComment({
|
||||
@Path() required String slug,
|
||||
@Part() required String body,
|
||||
@Part() int? parentCommentId,
|
||||
});
|
||||
|
||||
@GET('/api/recipes/{id}/comments/show')
|
||||
Future<CommentModel> getRecipesComments({
|
||||
@Path() required String id,
|
||||
|
||||
@@ -328,6 +328,79 @@ class _FeedService implements FeedService {
|
||||
await _dio.fetch<void>(_options);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<CommentModel> getPlansComments({required String slug}) async {
|
||||
final _extra = <String, dynamic>{};
|
||||
final queryParameters = <String, dynamic>{};
|
||||
final _headers = <String, dynamic>{};
|
||||
const Map<String, dynamic>? _data = null;
|
||||
final _options = _setStreamType<CommentModel>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/plans/${slug}/comments/show',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late CommentModel _value;
|
||||
try {
|
||||
_value = CommentModel.fromJson(_result.data!);
|
||||
} on Object catch (e, s) {
|
||||
errorLogger?.logError(e, s, _options);
|
||||
rethrow;
|
||||
}
|
||||
return _value;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> sendPlansComment({
|
||||
required String slug,
|
||||
required String body,
|
||||
int? parentCommentId,
|
||||
}) async {
|
||||
final _extra = <String, dynamic>{};
|
||||
final queryParameters = <String, dynamic>{};
|
||||
queryParameters.removeWhere((k, v) => v == null);
|
||||
final _headers = <String, dynamic>{};
|
||||
final _data = FormData();
|
||||
_data.fields.add(MapEntry(
|
||||
'body',
|
||||
body,
|
||||
));
|
||||
if (parentCommentId != null) {
|
||||
_data.fields.add(MapEntry(
|
||||
'parentCommentId',
|
||||
parentCommentId.toString(),
|
||||
));
|
||||
}
|
||||
final _options = _setStreamType<void>(Options(
|
||||
method: 'POST',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
)
|
||||
.compose(
|
||||
_dio.options,
|
||||
'/api/plans/${slug}/comment/create',
|
||||
queryParameters: queryParameters,
|
||||
data: _data,
|
||||
)
|
||||
.copyWith(
|
||||
baseUrl: _combineBaseUrls(
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
await _dio.fetch<void>(_options);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<CommentModel> getRecipesComments({required String id}) async {
|
||||
final _extra = <String, dynamic>{};
|
||||
|
||||
Reference in New Issue
Block a user