diff --git a/apps/admin-ui/src/clients/scopes/ClientScopes.tsx b/apps/admin-ui/src/clients/scopes/ClientScopes.tsx index 9e9eca814e..6bda44de4a 100644 --- a/apps/admin-ui/src/clients/scopes/ClientScopes.tsx +++ b/apps/admin-ui/src/clients/scopes/ClientScopes.tsx @@ -78,7 +78,9 @@ export const ClientScopes = ({ const [addDialogOpen, setAddDialogOpen] = useState(false); const [rest, setRest] = useState(); - const [selectedRows, setSelectedRows] = useState([]); + const [selectedRows, setSelectedRowState] = useState([]); + const setSelectedRows = (rows: Row[]) => + setSelectedRowState(rows.filter(({ id }) => id !== DEDICATED_ROW)); const [key, setKey] = useState(0); const refresh = () => setKey(key + 1); @@ -225,22 +227,19 @@ export const ClientScopes = ({ onClick={async () => { try { await Promise.all( - selectedRows.map(async (row) => { - await removeClientScope( + selectedRows.map((row) => + removeClientScope( adminClient, clientId, { ...row }, row.type as ClientScope - ); - }) + ) + ) ); setKebabOpen(false); setSelectedRows([]); - addAlert( - t("clients:clientScopeRemoveSuccess"), - AlertVariant.success - ); + addAlert(t("clients:clientScopeRemoveSuccess")); refresh(); } catch (error) { addError("clients:clientScopeRemoveError", error);