Sha256: 18fe5e7cb0cac71aa635758b1ad5eb3da4da92dda9e4ee412a01bcc169aa0421
Contents?: true
Size: 972 Bytes
Versions: 72
Compression:
Stored size: 972 Bytes
Contents
import React from 'react'; import { useSelector, useDispatch } from 'react-redux'; import URI from 'urijs'; import { SelectVariant } from '@patternfly/react-core'; import { get } from 'foremanReact/redux/API'; import { selectResponse, selectIsLoading } from '../../JobWizardSelectors'; import { SearchSelect } from '../form/SearchSelect'; export const useNameSearchAPI = (apiKey, url) => { const dispatch = useDispatch(); const uri = new URI(url); const onSearch = search => dispatch( get({ key: apiKey, url: uri.addSearch({ search: `name~"${search}"`, }), }) ); const response = useSelector(state => selectResponse(state, apiKey)); const isLoading = useSelector(state => selectIsLoading(state, apiKey)); return [onSearch, response, isLoading]; }; export const SelectAPI = props => ( <SearchSelect {...props} variant={SelectVariant.typeaheadMulti} useNameSearch={useNameSearchAPI} /> );
Version data entries
72 entries across 72 versions & 1 rubygems