Sha256: 07a16a5bb3a0191be2228d9edc2abe34144985cee731ab13933735240f9008e2
Contents?: true
Size: 864 Bytes
Versions: 20
Compression:
Stored size: 864 Bytes
Contents
import React from 'react'; import { useSelector, useDispatch } from 'react-redux'; import URI from 'urijs'; 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({ name: search, }), }) ); }; const response = useSelector(state => selectResponse(state, apiKey)); const isLoading = useSelector(state => selectIsLoading(state, apiKey)); return [onSearch, response, isLoading]; }; export const ResourceSelectAPI = props => ( <SearchSelect {...props} useNameSearch={useNameSearchAPI} /> );
Version data entries
20 entries across 20 versions & 1 rubygems