Skip to content

Commit a0b3106

Browse files
committed
fix: 更新标签和文章API路径以包含/admin
在LabelsPage函数中: - 修改了更新标签的API路径从`/labels/${editingLabel.id}`为`/admin/labels/${editingLabel.id}` - 修改了创建标签的API路径从`/labels`为`/admin/labels` 在MarkdownEditor函数中: - 修改了创建标签的API路径从`/labels`为`/admin/labels` - 修改了更新文章的API路径从`/posts/${postId}`为`/admin/posts/${postId}` - 修改了创建文章的API路径从`/posts`为`/admin/posts` 在PostsPage函数中: - 修改了删除文章的API路径从`/posts/${deleteId}`为`/admin/posts/${deleteId}`
1 parent bc0e48b commit a0b3106

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

frontend/app/(dashboard)/dashboard/labels/page.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,14 @@ export default function LabelsPage() {
6161
if (editingLabel) {
6262
// 更新标签
6363
const updated = await http.put<Label>(
64-
`/labels/${editingLabel.id}`,
64+
`/admin/labels/${editingLabel.id}`,
6565
formData,
6666
{ withToken: true }
6767
);
6868
setLabels(labels.map((l) => (l.id === editingLabel.id ? updated : l)));
6969
} else {
7070
// 创建标签
71-
const created = await http.post<Label>('/labels', formData, { withToken: true });
71+
const created = await http.post<Label>('/admin/labels', formData, { withToken: true });
7272
setLabels([...labels, created]);
7373
}
7474
setIsModalOpen(false);
@@ -85,7 +85,7 @@ export default function LabelsPage() {
8585

8686
setIsDeleting(true);
8787
try {
88-
await http.delete(`/labels/${deleteId}`, { withToken: true });
88+
await http.delete(`/admin/labels/${deleteId}`, { withToken: true });
8989
setLabels(labels.filter((l) => l.id !== deleteId));
9090
(document.getElementById('delete-modal') as HTMLDialogElement)?.close();
9191
} catch (error) {

frontend/app/(dashboard)/dashboard/posts/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export default function PostsPage() {
3434

3535
setIsDeleting(true);
3636
try {
37-
await http.delete(`/posts/${deleteId}`, { withToken: true });
37+
await http.delete(`/admin/posts/${deleteId}`, { withToken: true });
3838
setPosts(posts.filter((p) => p.id !== deleteId));
3939
(document.getElementById('delete-modal') as HTMLDialogElement)?.close();
4040
} catch (error) {

frontend/components/MarkdownEditor.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ export default function MarkdownEditor({ initialData, blogMode = false }: Markdo
353353
description: `${name}相关文章`,
354354
};
355355

356-
const newLabel = await http.post<Label>('/labels', labelData, {
356+
const newLabel = await http.post<Label>('/admin/labels', labelData, {
357357
withToken: true,
358358
});
359359

@@ -507,13 +507,13 @@ export default function MarkdownEditor({ initialData, blogMode = false }: Markdo
507507

508508
if (postId) {
509509
// 编辑模式 - 更新文章
510-
await http.put(`/posts/${postId}`, postData, {
510+
await http.put(`/admin/posts/${postId}`, postData, {
511511
withToken: true,
512512
});
513513
alert('文章更新成功!');
514514
} else {
515515
// 新建模式 - 创建文章
516-
await http.post('/posts', postData, {
516+
await http.post('/admin/posts', postData, {
517517
withToken: true,
518518
});
519519
alert(publish ? '文章发布成功!' : '草稿保存成功!');

0 commit comments

Comments
 (0)