mirror of
https://github.com/vkaelin/LeagueStats.git
synced 2026-03-25 12:57:28 +00:00
26 lines
575 B
JavaScript
26 lines
575 B
JavaScript
class JaxRequest {
|
|
constructor(endpoint, limiter, region) {
|
|
this.endpoint = endpoint
|
|
this.region = region
|
|
this.limiter = limiter
|
|
this.region = region
|
|
}
|
|
|
|
async execute() {
|
|
try {
|
|
const resp = await this.limiter.executing({
|
|
url: `https://${this.region}.api.riotgames.com/lol/${this.endpoint}`,
|
|
token: process.env.API_KEY,
|
|
resolveWithFullResponse: false
|
|
})
|
|
|
|
return JSON.parse(resp)
|
|
|
|
} catch ({ statusCode, ...rest }) {
|
|
console.log('error: ' + statusCode, rest)
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
export default JaxRequest
|