dnazarenkoo 857e505323
fix: fix initial columns for the list view / fix attributes API call (#3056)
* fix: fix initial columns for the list view

* fix: replace columns

* fix: update attribute api call for the options menu

* fix: update call attributes API call

* fix: add error msg for the options list
2023-07-07 15:59:45 +05:30

17 lines
435 B
TypeScript

import { SelectProps } from 'antd';
import { BaseAutocompleteData } from 'types/api/queryBuilder/queryAutocompleteResponse';
export const getOptionsFromKeys = (
keys: BaseAutocompleteData[],
selectedKeys: (string | undefined)[],
): SelectProps['options'] => {
const options = keys.map(({ id, key }) => ({
label: key,
value: id,
}));
return options.filter(
({ value }) => !selectedKeys.find((key) => key === value),
);
};