From 641d0ce4082440b451b0abbe432f6684d8120b72 Mon Sep 17 00:00:00 2001 From: "Mr.Hope" Date: Wed, 8 Mar 2023 23:01:38 +0800 Subject: [PATCH] chore(admin): refine AuthorField --- .../src/components/AuthorField/index.tsx | 39 ++++++++----------- 1 file changed, 16 insertions(+), 23 deletions(-) diff --git a/packages/admin/src/components/AuthorField/index.tsx b/packages/admin/src/components/AuthorField/index.tsx index 0e2f31dfb..09fe8f099 100644 --- a/packages/admin/src/components/AuthorField/index.tsx +++ b/packages/admin/src/components/AuthorField/index.tsx @@ -1,25 +1,18 @@ -import { getAllCollaboratorsList } from '@/services/van-blog/api'; import { ProFormSelect } from '@ant-design/pro-form'; -export default function () { - return ( - <> - { - const msg = await getAllCollaboratorsList(); +import { getAllCollaboratorsList } from '@/services/van-blog/api'; - return ( - msg?.data?.map((item) => ({ - label: item.nickname || item.name, - value: item.nickname || item.name, - })) || [] - ); - }} - /> - - ); -} +export default () => ( + + (await getAllCollaboratorsList())?.data?.map(({ name, nickname = name }) => ({ + label: nickname, + value: nickname, + })) || [] + } + /> +); \ No newline at end of file