26 lines
587 B
Plaintext
26 lines
587 B
Plaintext
---
|
|
import Layout from "@/layouts/Layout.astro";
|
|
import IndexView from "@/components/IndexView.astro";
|
|
import type { Post } from "@/types/post";
|
|
import { createHttp } from "@/lib/request";
|
|
import { metadata } from "@/consts.ts";
|
|
|
|
const http = createHttp(Astro.request.headers);
|
|
|
|
const { list, total } = await http.get<ApiPageResponse<Post>>("post", {
|
|
searchParams: {
|
|
page: 1,
|
|
page_size: metadata.postPageSize,
|
|
},
|
|
});
|
|
const totalPage = Math.ceil(total / metadata.postPageSize);
|
|
---
|
|
|
|
<Layout>
|
|
<IndexView
|
|
posts={list}
|
|
page={1}
|
|
totalPage={totalPage}
|
|
/>
|
|
</Layout>
|