Files
libnovel/ui/src/routes/discover/+page.server.ts
root 2473a0213e
Some checks failed
Release / Test backend (push) Successful in 47s
Release / Check ui (push) Successful in 1m48s
Release / Docker (push) Failing after 3m23s
Release / Gitea Release (push) Has been skipped
feat: redesign discover page — desktop two-col, full-screen mobile, skeleton, streaming, keyboard shortcuts
2026-04-13 17:11:09 +05:00

21 lines
818 B
TypeScript

import type { PageServerLoad } from './$types';
import { getBooksForDiscovery, getVotedBooks } from '$lib/server/pocketbase';
import type { DiscoveryPrefs } from '$lib/server/pocketbase';
export const load: PageServerLoad = async ({ locals, url }) => {
let prefs: DiscoveryPrefs | undefined;
const prefsParam = url.searchParams.get('prefs');
if (prefsParam) {
try { prefs = JSON.parse(prefsParam) as DiscoveryPrefs; } catch { /* ignore */ }
}
// Return promises directly — SvelteKit streams them, so the page transitions
// immediately and content resolves async (skeleton shown while loading).
return {
streamed: {
books: getBooksForDiscovery(locals.sessionId, locals.user?.id, prefs).catch(() => []),
votedBooks: getVotedBooks(locals.sessionId, locals.user?.id).catch(() => []),
}
};
};