From 27dcb4c15aa565c0037d9b76f1aec0148e0fafb2 Mon Sep 17 00:00:00 2001 From: besscroft Date: Sat, 29 Jun 2024 22:37:39 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=9B=B8=E5=86=8C?= =?UTF-8?q?=E7=BB=91=E5=AE=9A=E6=B2=A1=E6=9C=89=E9=A6=96=E9=A1=B5=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/v1/get-tags/route.ts | 9 ++++++++- components/admin/list/ListProps.tsx | 3 --- components/admin/upload/FileUpload.tsx | 3 --- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/api/v1/get-tags/route.ts b/app/api/v1/get-tags/route.ts index 218471a..c0cab6d 100644 --- a/app/api/v1/get-tags/route.ts +++ b/app/api/v1/get-tags/route.ts @@ -2,7 +2,14 @@ import 'server-only' import { fetchTagsList } from '~/server/lib/query' export async function GET() { - const data = await fetchTagsList(); + const res = await fetchTagsList(); + const data = [{ + name: '首页', + tag_value: '/' + }] + if (Array.isArray(res) && res.length > 0) { + data.push(...res) + } return Response.json(data) } diff --git a/components/admin/list/ListProps.tsx b/components/admin/list/ListProps.tsx index 6646be9..12c9301 100644 --- a/components/admin/list/ListProps.tsx +++ b/components/admin/list/ListProps.tsx @@ -171,9 +171,6 @@ export default function ListProps(props : Readonly) { 全部 - - 首页 - {tags?.map((tag: TagType) => ( {tag.name} diff --git a/components/admin/upload/FileUpload.tsx b/components/admin/upload/FileUpload.tsx index 17df109..c6b4592 100644 --- a/components/admin/upload/FileUpload.tsx +++ b/components/admin/upload/FileUpload.tsx @@ -516,9 +516,6 @@ export default function FileUpload() { setTag(updatedSet) }} > - - 首页 - {data?.map((tag: TagType) => ( {tag.name}