Files
website/src/routes/trackers/books/+page.server.ts

13 lines
596 B
TypeScript

import { isOwner } from '#lib/server/owner.js';
import { libraryCards, libraryStats } from '#lib/server/books/library.js';
import type { PageServerLoad } from './$types';
// Public catalogue: covers, titles, status, progress and rating. Files, formats and
// placeholders (no file yet) are only included for the owner.
export const load: PageServerLoad = async (event) => {
const owner = isOwner(event);
if (owner) event.setHeaders({ 'cache-control': 'private, no-store' });
const [books, stats] = await Promise.all([libraryCards(owner), libraryStats()]);
return { books, stats, owner };
};