<script lang="ts">
	import { page } from '$app/state';
	import EpubReader from '$lib/components/reader/epub-reader.svelte';

	let { data } = $props();

	const fileId = page.params.fileId!;
	const bookId = page.params.bookId!;

	// Fetched by the browser through the proxy, which attaches the auth header
	const fileUrl = `/api/books/download/${bookId}/${fileId}`;
</script>

<EpubReader
	{fileUrl}
	{bookId}
	title={data.title}
	filename={data.filename}
	initialProgress={data.initialProgress}
	initialEpubLoc={data.initialEpubLoc}
/>
