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