diff --git a/tone-page-web/lib/api/blog/get.ts b/tone-page-web/lib/api/blog/get.ts new file mode 100644 index 0000000..8ba17f2 --- /dev/null +++ b/tone-page-web/lib/api/blog/get.ts @@ -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}`); +} \ No newline at end of file diff --git a/tone-page-web/lib/api/blog/index.ts b/tone-page-web/lib/api/blog/index.ts new file mode 100644 index 0000000..03ea753 --- /dev/null +++ b/tone-page-web/lib/api/blog/index.ts @@ -0,0 +1,2 @@ +export * from './list'; +export * from './get'; \ No newline at end of file diff --git a/tone-page-web/lib/api/blog/list.ts b/tone-page-web/lib/api/blog/list.ts new file mode 100644 index 0000000..5fcd43c --- /dev/null +++ b/tone-page-web/lib/api/blog/list.ts @@ -0,0 +1,6 @@ +import { Blog } from "@/lib/types/blog"; +import fetcher from "../fetcher"; + +export async function list() { + return fetcher('/api/blog'); +} \ No newline at end of file diff --git a/tone-page-web/lib/api/index.ts b/tone-page-web/lib/api/index.ts index 26d5f04..2a60275 100644 --- a/tone-page-web/lib/api/index.ts +++ b/tone-page-web/lib/api/index.ts @@ -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'; \ No newline at end of file diff --git a/tone-page-web/lib/types/blog.ts b/tone-page-web/lib/types/blog.ts index 2b86acf..ec9b1c0 100644 --- a/tone-page-web/lib/types/blog.ts +++ b/tone-page-web/lib/types/blog.ts @@ -2,5 +2,7 @@ export interface Blog { id: string; title: string; description: string; + viewCount: number; contentUrl: string; + createdAt: string; } \ No newline at end of file