Something went wrong. Try again.
Join the GitHub Graduation Yearbook and "walk the stage" on June 5.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748const axios = require('axios');
class EducationWeb { constructor() {
}
async hasPack(github_identifier) { await this.authenticate()
const result = await axios({ method: "get", url: process.env.EDUCATION_WEB_API + "/api/user", headers: { "Authorization": "token " + this.authToken, "Accept": "application/vnd.education.github.v2" }, params: { github_identifier: github_identifier } })
const user_type = result?.data?.user?.type
return (user_type === "faculty" || user_type === "student") }
async authenticate() { if(this.authToken) { return }
const result = await axios({ method: "post", url: process.env.EDUCATION_WEB_API + "/api/auth", headers: { "Accept": "application/vnd.education.github.v2" }, data: { key: process.env.EDUCATION_WEB_KEY, secret: process.env.EDUCATION_WEB_SECRET } })
this.authToken = result.data.jwt }}
module.exports = new EducationWeb()