Files
website/src/routes/about/+page.server.ts
T

21 lines
810 B
TypeScript

import { about } from '#lib/content';
import { getAniListProfile } from '#lib/server/anilist';
import { getLibrary } from '#lib/server/library';
import { getListeningProfile } from '#lib/server/lastfm/profile';
import type { PageServerLoad } from './$types';
export const load: PageServerLoad = async () => {
const anilistUsername = about.anilistUsername;
const [anime, manga, library, listening] = await Promise.all([
anilistUsername ? getAniListProfile(anilistUsername, 'ANIME') : null,
anilistUsername ? getAniListProfile(anilistUsername, 'MANGA') : null,
getLibrary(),
about.lastfmUsername ? getListeningProfile(about.lastfmUsername) : null
]);
const hasManga = !!manga?.statusCounts.some((item) => item.count > 0);
return { anime, manga: hasManga ? manga : null, library, listening };
};