diff --git a/apps/cs/src/pages/admin/ui/add-admin-dialog.tsx b/apps/cs/src/pages/admin/ui/add-admin-dialog.tsx index c7ce5fb85..327473932 100644 --- a/apps/cs/src/pages/admin/ui/add-admin-dialog.tsx +++ b/apps/cs/src/pages/admin/ui/add-admin-dialog.tsx @@ -184,13 +184,14 @@ function AddAdminDialog() { return ( - + - 관리자 추가 + 관리자 등록 -
+ + setSelectedGroupId(value)}> - + @@ -244,7 +247,7 @@ function AddAdminDialog() { Object.keys(rowSelection).length === 0 || !selectedGroupId } > - 추가 + 등록 diff --git a/apps/cs/src/pages/admin/ui/admin-page.tsx b/apps/cs/src/pages/admin/ui/admin-page.tsx index 2599fa752..f5b971834 100644 --- a/apps/cs/src/pages/admin/ui/admin-page.tsx +++ b/apps/cs/src/pages/admin/ui/admin-page.tsx @@ -101,7 +101,7 @@ function AdminPage() { ...columns, ]; - const { tableComponent } = useDataTable({ + const { tableComponent, tableInstance: table } = useDataTable({ query, tableOptions: { columns: adminColumns, @@ -115,7 +115,6 @@ function AdminPage() { getCoreRowModel: getCoreRowModel(), onPaginationChange: setPagination, onRowSelectionChange: setRowSelection, - getRowId: (row) => row.userUnqId, }, dataTableOptions: { viewPagination: true, @@ -128,23 +127,21 @@ function AdminPage() { }; const handleDeleteAdmins = async () => { - const selectedRows = Object.keys(rowSelection); + const selectedRows = table.getSelectedRowModel().rows.map((row) => ({ + groupId: row.original.groupId, + userUnqId: row.original.userUnqId, + })); if (!(await confirm("관리자를 삭제하시겠습니까?"))) { return; } try { - const usersToDelete = selectedRows.map((userUnqId) => { - const admin = query.data?.content.find( - (item) => item.userUnqId === userUnqId, - ); - return { - mode: "D", - groupId: admin?.groupId || "", - userUnqId, - }; - }); + const usersToDelete = selectedRows.map((row) => ({ + mode: "D", + groupId: row.groupId, + userUnqId: row.userUnqId, + })); await GroupUsersApi.saveGroupUser(usersToDelete);