import React from 'react'; import get from 'lodash/get'; import { useDispatch } from 'react-redux'; import { requestUrlChanged, updateRequestMethod } from 'providers/ReduxStore/slices/collections'; import HttpMethodSelector from './HttpMethodSelector'; import { useTheme } from 'providers/Theme'; import SendIcon from 'components/Icons/Send'; import StyledWrapper from './StyledWrapper'; const QueryUrl = ({ item, collection, handleRun }) => { const { theme } = useTheme(); const dispatch = useDispatch(); const method = item.draft ? get(item, 'draft.request.method') : get(item, 'request.method'); let url = item.draft ? get(item, 'draft.request.url') : get(item, 'request.url'); const onUrlChange = (value) => { dispatch( requestUrlChanged({ itemUid: item.uid, collectionUid: collection.uid, url: value }) ); }; const onMethodSelect = (verb) => { dispatch( updateRequestMethod({ method: verb, itemUid: item.uid, collectionUid: collection.uid }) ); }; return (
onUrlChange(event.target.value)} />
); }; export default QueryUrl;