Filer out the dedicated row (#3440)
This commit is contained in:
parent
225ab19ef1
commit
961b8a098d
1 changed files with 8 additions and 9 deletions
|
@ -78,7 +78,9 @@ export const ClientScopes = ({
|
||||||
const [addDialogOpen, setAddDialogOpen] = useState(false);
|
const [addDialogOpen, setAddDialogOpen] = useState(false);
|
||||||
|
|
||||||
const [rest, setRest] = useState<ClientScopeRepresentation[]>();
|
const [rest, setRest] = useState<ClientScopeRepresentation[]>();
|
||||||
const [selectedRows, setSelectedRows] = useState<Row[]>([]);
|
const [selectedRows, setSelectedRowState] = useState<Row[]>([]);
|
||||||
|
const setSelectedRows = (rows: Row[]) =>
|
||||||
|
setSelectedRowState(rows.filter(({ id }) => id !== DEDICATED_ROW));
|
||||||
|
|
||||||
const [key, setKey] = useState(0);
|
const [key, setKey] = useState(0);
|
||||||
const refresh = () => setKey(key + 1);
|
const refresh = () => setKey(key + 1);
|
||||||
|
@ -225,22 +227,19 @@ export const ClientScopes = ({
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
try {
|
try {
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
selectedRows.map(async (row) => {
|
selectedRows.map((row) =>
|
||||||
await removeClientScope(
|
removeClientScope(
|
||||||
adminClient,
|
adminClient,
|
||||||
clientId,
|
clientId,
|
||||||
{ ...row },
|
{ ...row },
|
||||||
row.type as ClientScope
|
row.type as ClientScope
|
||||||
);
|
)
|
||||||
})
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
setKebabOpen(false);
|
setKebabOpen(false);
|
||||||
setSelectedRows([]);
|
setSelectedRows([]);
|
||||||
addAlert(
|
addAlert(t("clients:clientScopeRemoveSuccess"));
|
||||||
t("clients:clientScopeRemoveSuccess"),
|
|
||||||
AlertVariant.success
|
|
||||||
);
|
|
||||||
refresh();
|
refresh();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
addError("clients:clientScopeRemoveError", error);
|
addError("clients:clientScopeRemoveError", error);
|
||||||
|
|
Loading…
Reference in a new issue