getMyProfile method

Future<Either<ApiError, Profile>> getMyProfile()

Implementation

Future<Either<ApiError, Profile>> getMyProfile() {
  if (cache.get<Profile>("profile").shouldReload) {
    return get("$_profileRoutesPrefix/me", (json) => Profile.fromJson(json)).mapRight(
      (profile) {
        cache.get<Profile>("profile").data = profile;
        return profile;
      },
    );
  } else {
    return Future.value(
      Right(cache.get<Profile>("profile").data),
    );
  }
}