Skip to content

Commit e353c83

Browse files
committed
fix: avoid duplicate mock sponsors
1 parent 929b653 commit e353c83

2 files changed

Lines changed: 38 additions & 38 deletions

File tree

src/server/sponsors.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -210,25 +210,25 @@ async function getGithubSponsors() {
210210
console.error(
211211
'Invalid or missing GitHub credentials, returning mock data.',
212212
)
213-
return [
214-
'tannerlinsley',
215-
'tkdodo',
216-
'crutchcorn',
217-
'kevinvandy',
218-
'jherr',
219-
'seancassiere',
220-
'schiller-manuel',
221-
].flatMap((d) =>
222-
new Array(20).fill(d).map((_, i2) => ({
223-
login: d,
224-
name: d,
225-
amount: (20 - i2) / 20 + Math.random(),
226-
createdAt: new Date().toISOString(),
227-
private: false,
228-
linkUrl: `https://github.com/${d}`,
229-
imageUrl: `https://github.com/${d}.png`,
230-
})),
231-
)
213+
const mockSponsors = [
214+
'tannerlinsley',
215+
'tkdodo',
216+
'crutchcorn',
217+
'kevinvandy',
218+
'jherr',
219+
'seancassiere',
220+
'schiller-manuel',
221+
]
222+
223+
return mockSponsors.map((d, i) => ({
224+
login: d,
225+
name: d,
226+
amount: mockSponsors.length - i,
227+
createdAt: new Date().toISOString(),
228+
private: false,
229+
linkUrl: `https://github.com/${d}`,
230+
imageUrl: `https://github.com/${d}.png`,
231+
}))
232232
}
233233
if (error.status === 403) {
234234
console.error('GitHub rate limit exceeded, returning empty sponsors.')

src/utils/sponsors.functions.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -215,25 +215,25 @@ async function getGithubSponsors() {
215215
console.error(
216216
'Invalid or missing GitHub credentials, returning mock data.',
217217
)
218-
return [
219-
'tannerlinsley',
220-
'tkdodo',
221-
'crutchcorn',
222-
'kevinvandy',
223-
'jherr',
224-
'seancassiere',
225-
'schiller-manuel',
226-
].flatMap((d) =>
227-
new Array(20).fill(d).map((_, i2) => ({
228-
login: d,
229-
name: d,
230-
amount: (20 - i2) / 20 + Math.random(),
231-
createdAt: new Date().toISOString(),
232-
private: false,
233-
linkUrl: `https://github.com/${d}`,
234-
imageUrl: `https://github.com/${d}.png`,
235-
})),
236-
)
218+
const mockSponsors = [
219+
'tannerlinsley',
220+
'tkdodo',
221+
'crutchcorn',
222+
'kevinvandy',
223+
'jherr',
224+
'seancassiere',
225+
'schiller-manuel',
226+
]
227+
228+
return mockSponsors.map((d, i) => ({
229+
login: d,
230+
name: d,
231+
amount: mockSponsors.length - i,
232+
createdAt: new Date().toISOString(),
233+
private: false,
234+
linkUrl: `https://github.com/${d}`,
235+
imageUrl: `https://github.com/${d}.png`,
236+
}))
237237
}
238238

239239
if (error.status === 403) {

0 commit comments

Comments
 (0)