Giter Club home page Giter Club logo

Comments (6)

cnguy avatar cnguy commented on May 28, 2024

README (similar) example of what you want in the second case

const config = {
  options: {
    champListData: 'all'
  },
  region: REGIONS.KOREA
}

k.Static.champions(config)
        .then(data => console.log(data))
        .catch(error => console.error(error))

Your first example

Note that for options, my object-based functions always take in an options parameter. Which means you have to do:

const options = {
   champData: 'all'
}

k.Static.champions({
  id: champId, options
})

Your second example

Firstly, for a list of champions the proper parameter is champListData, while for a single champion it is champData (what you want here).

Secondly, you're wrapping the config in another dictionary, which means you end up with an extra layer of brackets:

{ // extra brackets because of { config }
  {
    options: {
      champData: 'all' // should be champListData
    }
  }
}

Remove the brackets around config, and convert champListData -> champData and it'll work.

Alternatives

If you'd like, you can use the methods that are more 'normal', which are documented here.

from kayn.

lucasbordini avatar lucasbordini commented on May 28, 2024

image

still without the informations of ListData

from kayn.

cnguy avatar cnguy commented on May 28, 2024

@lucasbordini

For getting the list of champions, it has to be champListData like in Riot's Docs (or my README). Yours is named champData (which is for getting a static champion by id) in the options.

const config = {
    options: {
        champListData: 'all'
    },
    region: REGIONS.BRAZIL
}

k.Static.champions(config)
    .then(data => console.log(data))
    .catch(error => console.error(error))

from kayn.

lucasbordini avatar lucasbordini commented on May 28, 2024

holy, I am feeling stupid now

sorry haha, it's works 👍

from kayn.

cnguy avatar cnguy commented on May 28, 2024

@lucasbordini
Not your fault. I'm going to clarify how it works in the README; I removed the old explanation when I migrated my documentation to the Wiki.

In addition, I just noticed I had the wrong example in the documentation. Sorry, I thought I fixed it (in case if this was the example you used; it's the same code).

from kayn.

cnguy avatar cnguy commented on May 28, 2024

@lucasbordini

I also realized that I misread your code (sorry) when I posted my first answer. I'm editing that answer so it's correct, although it seems we have solved the issue.

from kayn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.