完成博客增删改查
This commit is contained in:
6
tone-page-web/lib/api/admin/web/blog/get.ts
Normal file
6
tone-page-web/lib/api/admin/web/blog/get.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import fetcher from "@/lib/api/fetcher";
|
||||
import { Blog } from "@/lib/types/blog";
|
||||
|
||||
export async function get(id: string) {
|
||||
return fetcher<Blog>(`/api/admin/web/blog/${id}`)
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
export * from './create';
|
||||
export * from './remove';
|
||||
export * from './list';
|
||||
export * from './update';
|
||||
export * from './update';
|
||||
export * from './get';
|
||||
@@ -1,12 +1,14 @@
|
||||
import fetcher from "@/lib/api/fetcher";
|
||||
|
||||
type UpdateBlogParams = {
|
||||
|
||||
title: string;
|
||||
description: string;
|
||||
contentUrl: string;
|
||||
}
|
||||
|
||||
export async function update(id: string, data: UpdateBlogParams) {
|
||||
return fetcher(`/api/admin/web/blog/${id}`, {
|
||||
method: 'POST',
|
||||
method: 'PUT',
|
||||
body: JSON.stringify(data)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user