From 961b8a098d3a6fd0aecd399c80744a0c28551063 Mon Sep 17 00:00:00 2001 From: Erik Jan de Wit Date: Mon, 3 Oct 2022 12:47:50 +0200 Subject: [PATCH] Filer out the dedicated row (#3440) --- .../src/clients/scopes/ClientScopes.tsx | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) 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);