mock_community_repository.dart 832 B

123456789101112131415161718192021222324
  1. import 'package:eye_video/bizmodule/main/community/model/community_model.dart';
  2. import 'package:eye_video/bizmodule/main/community/respositories/community_repository.dart';
  3. import 'package:eye_video/framework/network/pretty_http.dart';
  4. class MockCommunityRepository extends CommunityRepository {
  5. @override
  6. Future<CommunityModel> fetchCommunity({String nextPageUrl}) async {
  7. try {
  8. Map<String, dynamic> reqParams;
  9. if (nextPageUrl == null || nextPageUrl.isEmpty) {
  10. reqParams = {};
  11. } else {
  12. reqParams = Uri.parse(nextPageUrl).queryParameters;
  13. }
  14. var resData = await PrettyHttp.get(
  15. "api/community/recommend/list",
  16. reqParams: reqParams,
  17. );
  18. return Future.value(CommunityModel.fromJson(resData));
  19. } catch (e) {
  20. return Future.error(e);
  21. }
  22. }
  23. }