getSentFriendRequests method
Implementation
Future<Either<FriendshipsErrors, List<Friendship>>> getSentFriendRequests(
String connectedUserId) async {
if (!cache.get<List<Friendship>>("sentRequest").shouldReload) {
return cache.get<List<Friendship>>("sentRequest").eitherData.mapLeft(
(error) => FriendshipsErrors(
originalRequestError: error, malformedFriendships: []));
}
return _completeFriendships(
get("$_routePrefix/requests/sent", (json) {
return (json as List<dynamic>)
.map((e) => Friendship.fromSentRequestJson(
e as Map<String, dynamic>, connectedUserId))
.toList();
}),
connectedUserId)
.mapRight((value) {
cache.get<List<Friendship>>("sentRequest").data = value;
return value;
});
}