import {useContextSection} from '@hooks';
import {context} from '../context';

export function useSearch(name: string, code: string) {
  const dispatch = useContextSection(context, state => state[1]);

  function onSearch() {
    dispatch({type: 'SEARCH', payload: {name, code}});
  }

  return onSearch;
}
