完成BlogApi

This commit is contained in:
2025-05-18 14:29:42 +08:00
parent 4f5f771e2b
commit 39f3e6b93c
5 changed files with 22 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
import { Blog } from "@/lib/types/blog";
import fetcher from "../fetcher";
export async function get(id: string) {
return fetcher<{
id: string;
title: string;
createdAt: string;
content: string;
}>(`/api/blog/${id}`);
}

View File

@@ -0,0 +1,2 @@
export * from './list';
export * from './get';

View File

@@ -0,0 +1,6 @@
import { Blog } from "@/lib/types/blog";
import fetcher from "../fetcher";
export async function list() {
return fetcher<Blog[]>('/api/blog');
}

View File

@@ -2,4 +2,5 @@ export * as authApi from './auth/index';
export * as verificationApi from './verification/index';
export * as AdminApi from './admin/index';
export * as ResourceApi from './resource/index';
export * as BlogApi from './blog/index';
export * as UserApi from './user/index';

View File

@@ -2,5 +2,7 @@ export interface Blog {
id: string;
title: string;
description: string;
viewCount: number;
contentUrl: string;
createdAt: string;
}