diff --git a/apps/cs/src/pages/groups/ui/group-users-section.tsx b/apps/cs/src/pages/groups/ui/group-users-section.tsx index 7b077a570..dc16fda60 100644 --- a/apps/cs/src/pages/groups/ui/group-users-section.tsx +++ b/apps/cs/src/pages/groups/ui/group-users-section.tsx @@ -57,7 +57,6 @@ function GroupUsersSection({ groupId }: GroupUsersSectionProps) { getCoreRowModel: getCoreRowModel(), onPaginationChange: setPagination, onRowSelectionChange: setRowSelection, - getRowId: (row) => row.userUnqId, }, dataTableOptions: { viewPagination: true, @@ -65,15 +64,18 @@ function GroupUsersSection({ groupId }: GroupUsersSectionProps) { }); const handleDeleteSelected = async () => { - const selectedRows = Object.keys(rowSelection); + const selectedRows = table.getSelectedRowModel().rows.map((row) => ({ + groupId: row.original.groupId, + userUnqId: row.original.userUnqId, + })); if (selectedRows.length === 0 || !groupId) return; if (!(await confirm("사용자를 삭제하시겠습니까?"))) return; try { - const usersToDelete = selectedRows.map((userUnqId) => ({ + const usersToDelete = selectedRows.map((row) => ({ mode: "D", - groupId, - userUnqId, + groupId: row.groupId, + userUnqId: row.userUnqId, })); await GroupUsersApi.saveGroupUser(usersToDelete); @@ -90,6 +92,7 @@ function GroupUsersSection({ groupId }: GroupUsersSectionProps) { useEffect(() => { setPagination({ ...pagination, pageIndex: 0 }); + setRowSelection({}); }, [groupId]); return (