diff --git a/src/pages/admin/ActiveMemberManage/Input/MemberTypeChangeInput.tsx b/src/pages/admin/ActiveMemberManage/Input/MemberTypeChangeInput.tsx index 66ac2250..63c3356c 100644 --- a/src/pages/admin/ActiveMemberManage/Input/MemberTypeChangeInput.tsx +++ b/src/pages/admin/ActiveMemberManage/Input/MemberTypeChangeInput.tsx @@ -15,14 +15,9 @@ const MemberTypeChangeInput = ({ }: MemberTypeChangeInputProps) => { const options: { value: number; label: string; group: string }[] = []; memberList?.forEach((data) => options.push({ value: data.memberId, label: data.realName, group: data.generation })); - const sortedOptions = options.sort((a, b) => { - const aGroup = parseFloat(a.group); - const bGroup = parseFloat(b.group); - if (aGroup !== bGroup) { - return aGroup - bGroup; - } - return a.label.localeCompare(b.label); - }); + const sortedOptions = options.sort( + (a, b) => parseFloat(a.group) - parseFloat(b.group) || a.label.localeCompare(b.label), + ); return ( options.push({ value: data.memberId, label: data.realName, group: data.generation })); - const sortedOptions = options.sort((a, b) => { - const aGroup = parseFloat(a.group); - const bGroup = parseFloat(b.group); - if (aGroup !== bGroup) { - return aGroup - bGroup; - } - return a.label.localeCompare(b.label); - }); + const sortedOptions = options.sort( + (a, b) => parseFloat(a.group) - parseFloat(b.group) || a.label.localeCompare(b.label), + ); const [value, setValue] = useState(null); const [prevInfo, setPrevInfo] = useState<{ value: number; label: string; group: string }>({