getSocialFeed function

Future<SocialFeedResponse> getSocialFeed(
  1. {bool isForYou = true}
)

Implementation

Future<SocialFeedResponse> getSocialFeed({bool isForYou = true}) async {
  log("-------------- Social Feed Api Call -------------");

  String userId = appStore.isLoggedIn ? 'user_id=${appStore.userId}' : '';
  String isFollowing = !isForYou ? '&is_following=1' : '';

  appStore.setLoading(true);
  try {
    var res = SocialFeedResponse.fromMap(await (handleResponse(await buildHttpResponse('${APIEndPoint.socialFeedList}?$userId$isFollowing', method: HttpMethod.GET))));
    appStore.setLoading(false);
    if (isForYou) {
      forYouFeedData = res;
    } else {
      followingFeedData = res;
    }
    return res;
  } catch (e) {
    appStore.setLoading(false);
    throw errorSomethingWentWrong;
  }
}