Monday, 12 June 2017

Request failed; Required params

i'm running nodejs application on localhost, everything went smooth until i encountered this error

Error: getLeaguePositions request FAILED; required params `id/summonerId/playerId` (int), `accountId/accId` (int), or `name` (string) not passed in
at updateLeague (C:\Users\Mikk\be\helpers\summonerProfile.js:104:27)

Not sure how would i approach to this error? My code for that method

function updateLeague(profile) {
  const { region } = profile;
  return leagueApi.League.positions({id: profile['summonerId'], region})
  .then((league) => {
    let leagueRanks = [];
    for (let entry of league) {
      let { queueType, tier, rank, leaguePoints } = entry;
      leagueRanks.push({
        queueType,
        tier,
        division: rank,
        leaguePoints
      });
    }
    profile['leagueRanks'] = leagueRanks;
    return profile;
  }).catch((err) => {
    if (err.message == 'Error getting league data: 404 Not Found') {
      return profile;
    }
    else {
      handleErr(err);
    }
  });
}



via Mikk Küttim

No comments:

Post a Comment