Skip to content

Commit

Permalink
try to use filtered info
Browse files Browse the repository at this point in the history
  • Loading branch information
rfay committed Nov 8, 2024
1 parent 1d06856 commit d9477dc
Showing 1 changed file with 47 additions and 34 deletions.
81 changes: 47 additions & 34 deletions src/lib/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,51 +85,64 @@ export async function getSponsors() {
}

const response = await octokit().graphql(`
query {
user(login: "rfay") {
... on Sponsorable {
sponsors(first: 100, isActive: true) {
totalCount
nodes {
... on User {
login
url
avatarUrl
}
... on Organization {
login
url
avatarUrl
}
query {
user(login: "rfay") {
... on Sponsorable {
sponsors(first: 100) {
totalCount
nodes {
... on User {
login
url
avatarUrl
sponsorshipForViewerIsActive
}
... on Organization {
login
url
avatarUrl
sponsorshipForViewerIsActive
}
}
}
}
organization(login: "ddev") {
... on Sponsorable {
sponsors(first: 100, isActive: true) {
totalCount
nodes {
... on User {
login
url
avatarUrl
}
... on Organization {
login
url
avatarUrl
}
}
organization(login: "ddev") {
... on Sponsorable {
sponsors(first: 100) {
totalCount
nodes {
... on User {
login
url
avatarUrl
sponsorshipForViewerIsActive
}
... on Organization {
login
url
avatarUrl
sponsorshipForViewerIsActive
}
}
}
}
}
`)
}
`);

// Filter for active sponsors
const activeSponsors = {
rfay: response.user.sponsors.nodes.filter(sponsor => sponsor.sponsorshipForViewerIsActive),
ddev: response.organization.sponsors.nodes.filter(sponsor => sponsor.sponsorshipForViewerIsActive),
};

const rfayData = response.user.sponsors.nodes
const orgData = response.organization.sponsors.nodes
const rfayData = activeSponsors.rfay.nodes
const orgData = activeSponsors.ddev.nodes
const data = [...rfayData, ...orgData]

console.log("rfayData", rfayData)
console.log("orgData", orgData)

putCache(cacheFilename, JSON.stringify(data))

Expand Down

0 comments on commit d9477dc

Please sign in to comment.