forked from eatvio/eatvio_app
feat(diary): add diary page, calendar, meals
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:eatvio_app/features/feed/models/feed_blog_post_settings_model.dart';
|
||||
import 'package:eatvio_app/features/feed/models/feed_blog_post_model.dart';
|
||||
import 'package:eatvio_app/features/profile/models/circumference_model.dart';
|
||||
import 'package:eatvio_app/features/profile/models/profile_model.dart';
|
||||
import 'package:eatvio_app/features/profile/models/weight_model.dart';
|
||||
import 'package:retrofit/retrofit.dart';
|
||||
|
||||
part 'profile_service.g.dart';
|
||||
|
||||
@RestApi()
|
||||
@@ -35,7 +34,7 @@ abstract class ProfileService {
|
||||
});
|
||||
|
||||
@GET('/api/blogPosts/search_by_author/{slug}')
|
||||
Future<FeedBlogPostSettingsModel> getBlogPostByAuthorSlug({
|
||||
Future<List<FeedBlogPostModel>> getBlogPostByAuthorSlug({
|
||||
@Path() required String slug,
|
||||
});
|
||||
|
||||
|
||||
@@ -191,13 +191,13 @@ class _ProfileService implements ProfileService {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<FeedBlogPostSettingsModel> getBlogPostByAuthorSlug(
|
||||
Future<List<FeedBlogPostModel>> getBlogPostByAuthorSlug(
|
||||
{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<FeedBlogPostSettingsModel>(Options(
|
||||
final _options = _setStreamType<List<FeedBlogPostModel>>(Options(
|
||||
method: 'GET',
|
||||
headers: _headers,
|
||||
extra: _extra,
|
||||
@@ -213,10 +213,13 @@ class _ProfileService implements ProfileService {
|
||||
_dio.options.baseUrl,
|
||||
baseUrl,
|
||||
)));
|
||||
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
|
||||
late FeedBlogPostSettingsModel _value;
|
||||
final _result = await _dio.fetch<List<dynamic>>(_options);
|
||||
late List<FeedBlogPostModel> _value;
|
||||
try {
|
||||
_value = FeedBlogPostSettingsModel.fromJson(_result.data!);
|
||||
_value = _result.data!
|
||||
.map((dynamic i) =>
|
||||
FeedBlogPostModel.fromJson(i as Map<String, dynamic>))
|
||||
.toList();
|
||||
} on Object catch (e, s) {
|
||||
errorLogger?.logError(e, s, _options);
|
||||
rethrow;
|
||||
|
||||
Reference in New Issue
Block a user