Skip to content

Commit b48ac38

Browse files
committed
🧹 chore: fix oiia
1 parent 56621c0 commit b48ac38

File tree

3 files changed

+206
-183
lines changed

3 files changed

+206
-183
lines changed

docs/.vitepress/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ export default defineConfig({
124124
detailedView: true
125125
}
126126
},
127-
logo: '/oiia/oiia-static.webp',
127+
logo: '/assets/elysia.svg',
128128
nav: [
129129
{
130130
text: 'Cheat Sheet',
Lines changed: 41 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11
import { defineLoader } from 'vitepress'
22

33
export interface Sponsor {
4-
sponsorEntity: {
5-
login: string
6-
name: string
7-
avatarUrl: string
8-
}
9-
createdAt: string
10-
tier: {
11-
isOneTime: boolean
12-
isCustomAmount: boolean
13-
monthlyPriceInDollars: number
14-
}
4+
sponsorEntity: {
5+
login: string
6+
name: string
7+
avatarUrl: string
8+
}
9+
createdAt: string
10+
tier: {
11+
isOneTime: boolean
12+
isCustomAmount: boolean
13+
monthlyPriceInDollars: number
14+
}
1515
}
1616

1717
declare const data: Sponsor[]
1818
export { data }
1919

2020
export default defineLoader({
21-
async load(): Promise<Sponsor[]> {
22-
try {
23-
const result = await fetch('https://api.github.com/graphql', {
24-
method: 'POST',
25-
headers: {
26-
'content-type': 'application/json',
27-
Authorization: `Bearer ${process.env.GITHUB_TOKEN}`
28-
},
29-
body: JSON.stringify({
30-
query: `{
21+
async load(): Promise<Sponsor[]> {
22+
try {
23+
const result = await fetch('https://api.github.com/graphql', {
24+
method: 'POST',
25+
headers: {
26+
'content-type': 'application/json',
27+
Authorization: `Bearer ${process.env.GITHUB_TOKEN}`
28+
},
29+
body: JSON.stringify({
30+
query: `{
3131
user(login: "saltyaom") {
3232
sponsorshipsAsMaintainer(
3333
first: 100
@@ -56,23 +56,26 @@ export default defineLoader({
5656
}
5757
}
5858
}`
59-
})
60-
}).then((x) => x.json())
59+
})
60+
}).then((x) => x.json())
6161

62-
const data: Sponsor[] =
63-
result.data?.user?.sponsorshipsAsMaintainer?.nodes || []
62+
const data: Sponsor[] =
63+
result.data?.user?.sponsorshipsAsMaintainer?.nodes || []
6464

65-
return data
66-
.filter((x) => !x.tier.isOneTime)
67-
.sort(
68-
(a, b) =>
69-
b?.tier?.monthlyPriceInDollars -
70-
a?.tier?.monthlyPriceInDollars ||
71-
new Date(a?.createdAt).getTime() -
72-
new Date(b?.createdAt).getTime()
73-
)
74-
} catch {
75-
return []
76-
}
77-
}
65+
return data
66+
.filter((x) => !x.tier.isOneTime)
67+
.sort(
68+
(a, b) =>
69+
b?.tier?.monthlyPriceInDollars -
70+
a?.tier?.monthlyPriceInDollars ||
71+
new Date(a?.createdAt).getTime() -
72+
new Date(b?.createdAt).getTime()
73+
)
74+
} catch (error) {
75+
console.warn('Fetch sponsors error')
76+
console.warn(error)
77+
78+
return []
79+
}
80+
}
7881
})

0 commit comments

Comments
 (0)