diff --git a/src/lib/api.ts b/src/lib/api.ts index 5b9fa7ad..054661c3 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -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))