feat(footer): use info endpoint

This commit is contained in:
Ushie
2023-08-20 00:42:06 +03:00
parent eb31b942f4
commit d1c763c1d3
3 changed files with 67 additions and 34 deletions

View File

@@ -9,13 +9,15 @@ import type {
TeamMember,
DonationPlatform,
CryptoWallet,
Social
Social,
Info
} from '$lib/types';
export type ReposData = { repositories: Repository[] };
export type PatchesData = { patches: Patch[]; packages: string[] };
export type ReleaseData = { metadata: Metadata; assets: Asset[] };
export type TeamData = { members: TeamMember[] };
export type InfoData = { info: Info };
export type DonationData = { wallets: CryptoWallet[]; platforms: DonationPlatform[] };
export type SocialsData = { socials: Social[] };
@@ -49,7 +51,7 @@ async function patches(): Promise<PatchesData> {
// sort packages by patch count to get most relevant apps on top
const packages = Object.keys(packagesWithCount);
packages.sort((a, b) => packagesWithCount[b] - packagesWithCount[a]);
packages.sort((a, b) => packagesWithCount[b] - packagesWithCount[a]);
return { patches: json.patches, packages };
}
@@ -59,6 +61,11 @@ async function team(): Promise<TeamData> {
return { members: json.members };
}
async function info(): Promise<InfoData> {
const json = await get_json('v2/info');
return { info: json.info };
}
async function donate(): Promise<DonationData> {
const json = await get_json('v2/donations');
return { wallets: json.donations.wallets, platforms: json.donations.links };
@@ -91,6 +98,11 @@ export const queries = {
queryFn: team,
staleTime
},
info: {
queryKey: ['info'],
queryFn: info,
staleTime
},
donate: {
queryKey: ['donate'],
queryFn: donate,