forked from tanner/qotnews
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
844 B
33 lines
844 B
<script context="module"> |
|
export async function preload(page) { |
|
const { skip, limit } = { |
|
skip: page.query.skip || 0, |
|
limit: page.query.limit || 20, |
|
}; |
|
const res = await this.fetch(`index.json?skip=${skip}&limit=${limit}`); |
|
const data = await res.json(); |
|
|
|
if (res.status === 200) { |
|
return { stories: data.stories, skip, limit }; |
|
} else { |
|
this.error(res.status, data.message); |
|
} |
|
} |
|
</script> |
|
|
|
<script> |
|
import StoryList from "../components/StoryList.svelte"; |
|
import Pagination from "../components/Pagination.svelte"; |
|
|
|
export let stories; |
|
</script> |
|
|
|
<svelte:head> |
|
<title>QotNews</title> |
|
<meta property="og:title" content="QotNews" /> |
|
<meta property="og:type" content="website" /> |
|
</svelte:head> |
|
|
|
<StoryList {stories}> |
|
<Pagination href="/" count={stories.length} /> |
|
</StoryList>
|
|
|