You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

isSponsoringMe.ts 611B

123456789101112131415161718192021222324
  1. const whitelist = ['steveruizok']
  2. export async function isSponsoringMe(login: string) {
  3. if (whitelist.includes(login)) return true
  4. const res = await fetch('https://api.github.com/graphql', {
  5. method: 'POST',
  6. headers: {
  7. 'Content-Type': 'application/json',
  8. Authorization: 'bearer ' + process.env.GITHUB_API_SECRET,
  9. },
  10. body: JSON.stringify({
  11. query: `
  12. query {
  13. user(login: "steveruizok") {
  14. isSponsoredBy(accountLogin: "${login}")
  15. }
  16. }
  17. `,
  18. }),
  19. }).then((res) => res.json())
  20. return res?.data?.user?.isSponsoredBy
  21. }