feat: 调整博客页以支持slug
This commit is contained in:
@@ -3,16 +3,17 @@ import { serverFetch } from "../server";
|
||||
|
||||
export async function list() {
|
||||
return serverFetch<Pick<Blog,
|
||||
'id' | 'title' | 'description' | 'viewCount' | 'createdAt' | 'updatedAt' | 'deletedAt'
|
||||
'id' | 'title' | 'slug' | 'description' | 'viewCount' | 'createdAt' | 'updatedAt' | 'deletedAt'
|
||||
>[]>('/api/blog')
|
||||
}
|
||||
|
||||
export async function getBlog(id: string, password?: string) {
|
||||
export async function getBlogBySlug(slug: string, password?: string) {
|
||||
return serverFetch<{
|
||||
id: string;
|
||||
title: string;
|
||||
description: string;
|
||||
createdAt: string;
|
||||
content: string;
|
||||
}>(`/api/blog/${id}` + (password ? `?p=${password}` : ''));
|
||||
}
|
||||
}>(`/api/blog/${slug}/slug` + (password ? `?p=${password}` : ''));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user