feat: 首页改版
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
---
|
||||
import Layout from "@/layouts/Layout.astro";
|
||||
import PostList from "@/components/PostList.astro";
|
||||
import type {Post} from "@/types/post";
|
||||
import IndexView from "@/components/IndexView.astro";
|
||||
import type {Post, CategoriesStats} from "@/types/post";
|
||||
import {createHttp} from "@/lib/request";
|
||||
import {metadata} from "@/consts.ts";
|
||||
|
||||
@@ -13,10 +13,11 @@ const {list, total} = await http.get<ApiPageResponse<Post>>("post", {
|
||||
page_size: metadata.postPageSize
|
||||
}
|
||||
});
|
||||
|
||||
const totalPage = Math.ceil(total / metadata.postPageSize)
|
||||
|
||||
const {data: categories} = await http.get<ApiPageResponse<CategoriesStats>>("category/stats");
|
||||
---
|
||||
|
||||
<Layout>
|
||||
<PostList posts={list} page={1} totalPage={totalPage}/>
|
||||
<IndexView categories={categories} posts={list} page={1} totalPage={totalPage}/>
|
||||
</Layout>
|
||||
|
||||
Reference in New Issue
Block a user