Last active
May 29, 2021 17:30
-
-
Save jerrymannel/f95c265095d9b10ed89908112b470b67 to your computer and use it in GitHub Desktop.
apiClient.js
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 URLS = { | |
states: "https://cdn-api.co-vin.in/api/v2/admin/location/states", | |
vaccinationCenters: "https://cdn-api.co-vin.in/api/v2/appointment/sessions/public/calendarByDistrict" | |
} | |
async function api(url) { | |
const options = { | |
url: url, | |
method: "GET", | |
headers: { | |
"referer": "https://www.cowin.gov.in/", | |
"user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36" | |
}, | |
validateStatus: (_status) => { | |
return true | |
} | |
}; | |
return axios(options); | |
}; | |
let response = await api(`${URLS.vaccinationCenters}?date=${currentWeek}&district_id=${_currDistrict[0]}`) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment