getBlogPosts method
Gets all blog posts, optionally filtered by category
Implementation
Future<Iterable<BlogPost>> getBlogPosts({int? categoryId}) async {
var url = '/api/blog/post';
if (categoryId != null) {
url = '/api/blog/category/$categoryId/post';
}
final response = await _get(url);
return response.data['items'].map<BlogPost>((e) => BlogPost.fromJson(e));
}