完成博客、资源管理api
This commit is contained in:
12
tone-page-web/lib/api/admin/web/blog/create.ts
Normal file
12
tone-page-web/lib/api/admin/web/blog/create.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import fetcher from "@/lib/api/fetcher";
|
||||
|
||||
type CreateBlogParams = {
|
||||
|
||||
}
|
||||
|
||||
export async function create(data: CreateBlogParams) {
|
||||
return fetcher('/admin/web/blog', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(data)
|
||||
})
|
||||
}
|
||||
4
tone-page-web/lib/api/admin/web/blog/index.ts
Normal file
4
tone-page-web/lib/api/admin/web/blog/index.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export * from './create';
|
||||
export * from './remove';
|
||||
export * from './list';
|
||||
export * from './update';
|
||||
5
tone-page-web/lib/api/admin/web/blog/list.ts
Normal file
5
tone-page-web/lib/api/admin/web/blog/list.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import fetcher from "@/lib/api/fetcher";
|
||||
|
||||
export async function list() {
|
||||
return fetcher('/admin/web/blog')
|
||||
}
|
||||
7
tone-page-web/lib/api/admin/web/blog/remove.ts
Normal file
7
tone-page-web/lib/api/admin/web/blog/remove.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import fetcher from "@/lib/api/fetcher";
|
||||
|
||||
export async function remove(id: string) {
|
||||
return fetcher(`/admin/web/blog/${id}`, {
|
||||
method: 'DELETE',
|
||||
})
|
||||
}
|
||||
12
tone-page-web/lib/api/admin/web/blog/update.ts
Normal file
12
tone-page-web/lib/api/admin/web/blog/update.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import fetcher from "@/lib/api/fetcher";
|
||||
|
||||
type UpdateBlogParams = {
|
||||
|
||||
}
|
||||
|
||||
export async function update(id: string, data: UpdateBlogParams) {
|
||||
return fetcher(`/admin/web/blog/${id}`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(data)
|
||||
})
|
||||
}
|
||||
2
tone-page-web/lib/api/admin/web/index.ts
Normal file
2
tone-page-web/lib/api/admin/web/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from './blog/index';
|
||||
export * from './resrouce/index';
|
||||
19
tone-page-web/lib/api/admin/web/resrouce/create.ts
Normal file
19
tone-page-web/lib/api/admin/web/resrouce/create.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import fetcher from "@/lib/api/fetcher";
|
||||
|
||||
type CreateResourceParams = {
|
||||
title: string;
|
||||
description: string;
|
||||
imageUrl: string;
|
||||
link: string;
|
||||
tags: {
|
||||
name: string;
|
||||
type: string;
|
||||
}[];
|
||||
}
|
||||
|
||||
export async function create(data: CreateResourceParams) {
|
||||
return fetcher('/admin/web/resource', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(data)
|
||||
})
|
||||
}
|
||||
4
tone-page-web/lib/api/admin/web/resrouce/index.ts
Normal file
4
tone-page-web/lib/api/admin/web/resrouce/index.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export * from './create';
|
||||
export * from './remove';
|
||||
export * from './list';
|
||||
export * from './update';
|
||||
5
tone-page-web/lib/api/admin/web/resrouce/list.ts
Normal file
5
tone-page-web/lib/api/admin/web/resrouce/list.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import fetcher from "@/lib/api/fetcher";
|
||||
|
||||
export async function list() {
|
||||
return fetcher('/admin/web/resource')
|
||||
}
|
||||
7
tone-page-web/lib/api/admin/web/resrouce/remove.ts
Normal file
7
tone-page-web/lib/api/admin/web/resrouce/remove.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import fetcher from "@/lib/api/fetcher";
|
||||
|
||||
export async function remove(id: string) {
|
||||
return fetcher(`/admin/web/resource/${id}`, {
|
||||
method: 'DELETE',
|
||||
})
|
||||
}
|
||||
19
tone-page-web/lib/api/admin/web/resrouce/update.ts
Normal file
19
tone-page-web/lib/api/admin/web/resrouce/update.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import fetcher from "@/lib/api/fetcher";
|
||||
|
||||
type UpdateResourceParams = {
|
||||
title: string;
|
||||
description: string;
|
||||
imageUrl: string;
|
||||
link: string;
|
||||
tags: {
|
||||
name: string;
|
||||
type: string;
|
||||
}[];
|
||||
}
|
||||
|
||||
export async function update(id: string, data: UpdateResourceParams) {
|
||||
return fetcher(`/admin/web/resource/${id}`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(data)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user