Files
tonePage/apps/frontend/lib/api/endpoints/blog.server.ts
tone db8d8c429d
Some checks failed
Deploy to K3s / deploy (push) Failing after 1m2s
feat: 调整博客页获取数据部分为服务端渲染
2025-12-25 15:00:06 +08:00

18 lines
545 B
TypeScript

import { Blog } from "@/lib/types/blog";
import { serverFetch } from "../server";
export async function list() {
return serverFetch<Pick<Blog,
'id' | 'title' | 'description' | 'viewCount' | 'createdAt' | 'updatedAt' | 'deletedAt'
>[]>('/api/blog')
}
export async function getBlog(id: string, password?: string) {
return serverFetch<{
id: string;
title: string;
description: string;
createdAt: string;
content: string;
}>(`/api/blog/${id}` + (password ? `?p=${password}` : ''));
}