Last active
August 7, 2020 20:09
-
-
Save brycetshaw/9cf3454bde3998d4ba2eac2ee375a9f1 to your computer and use it in GitHub Desktop.
Makes a network request!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fetch = require('node-fetch'); | |
async function getNumOfGamesFromPage(year, goals, page) { | |
const response = await fetch(queryString(year, goals, page)) | |
.catch(err => console.log("get error " + err.message)); | |
const json = await response.json(); | |
if (page === 0) { | |
return [json.data.length, json.total_pages]; | |
} else { | |
return json.data.length; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment