Skip to content

Instantly share code, notes, and snippets.

@jerrymannel
Last active May 29, 2021 17:30
Show Gist options
  • Save jerrymannel/f95c265095d9b10ed89908112b470b67 to your computer and use it in GitHub Desktop.
Save jerrymannel/f95c265095d9b10ed89908112b470b67 to your computer and use it in GitHub Desktop.
apiClient.js
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