Skip to content

Commit

Permalink
chore(admin): refine AuthorField (#239)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mister-Hope authored Mar 11, 2023
1 parent ecb5259 commit 6c480d8
Showing 1 changed file with 16 additions and 23 deletions.
39 changes: 16 additions & 23 deletions packages/admin/src/components/AuthorField/index.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,18 @@
import { getAllCollaboratorsList } from '@/services/van-blog/api';
import { ProFormSelect } from '@ant-design/pro-form';
export default function () {
return (
<>
<ProFormSelect
width="md"
id="author"
name="author"
label="作者"
placeholder="不填默认为登录者本人"
request={async () => {
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 () => (
<ProFormSelect
width="md"
id="author"
name="author"
label="作者"
placeholder="不填默认为登录者本人"
request={async () =>
(await getAllCollaboratorsList())?.data?.map(({ name, nickname = name }) => ({
label: nickname,
value: nickname,
})) || []
}
/>
);

0 comments on commit 6c480d8

Please sign in to comment.