mirror of
https://github.com/ReVanced/revanced-website.git
synced 2026-01-19 01:03:56 +00:00
@@ -8,14 +8,16 @@ import type {
|
||||
Asset,
|
||||
TeamMember,
|
||||
DonationPlatform,
|
||||
CryptoWallet
|
||||
CryptoWallet,
|
||||
Social
|
||||
} from '$lib/types';
|
||||
|
||||
export type ReposData = Repository[];
|
||||
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 DonationData = { wallets: CryptoWallet[]; platforms: DonationPlatform[] };
|
||||
export type SocialsData = { socials: Social[] };
|
||||
|
||||
async function get_json(endpoint: string) {
|
||||
const url = `${settings.api_base_url()}/${endpoint}`;
|
||||
@@ -23,7 +25,8 @@ async function get_json(endpoint: string) {
|
||||
}
|
||||
|
||||
async function repositories(): Promise<ReposData> {
|
||||
return await get_json('contributors').then((json) => json.repositories);
|
||||
const json = await get_json('contributors');
|
||||
return { repositories: json.repositories };
|
||||
}
|
||||
|
||||
async function manager(): Promise<ReleaseData> {
|
||||
@@ -59,10 +62,14 @@ async function team(): Promise<TeamData> {
|
||||
|
||||
async function donate(): Promise<DonationData> {
|
||||
const json = await get_json('v2/donations');
|
||||
|
||||
return { wallets: json.donations.wallets, platforms: json.donations.links };
|
||||
}
|
||||
|
||||
async function socials(): Promise<SocialsData> {
|
||||
const json = await get_json('v2/socials');
|
||||
return { socials: json.socials };
|
||||
}
|
||||
|
||||
export const staleTime = 5 * 60 * 1000;
|
||||
export const queries = {
|
||||
manager: {
|
||||
@@ -89,5 +96,10 @@ export const queries = {
|
||||
queryKey: ['donate'],
|
||||
queryFn: donate,
|
||||
staleTime
|
||||
},
|
||||
socials: {
|
||||
queryKey: ['socials'],
|
||||
queryFn: socials,
|
||||
staleTime
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user