forked from extern/bruno
feat: run request upon cmd+enter from response pane
This commit is contained in:
parent
6b43159be2
commit
695f42df80
@ -1,17 +1,23 @@
|
||||
import React from 'react';
|
||||
import CodeEditor from 'components/CodeEditor';
|
||||
import { useTheme } from 'providers/Theme';
|
||||
import { useDispatch } from 'react-redux';
|
||||
import { sendRequest } from 'providers/ReduxStore/slices/collections/actions';
|
||||
|
||||
import StyledWrapper from './StyledWrapper';
|
||||
|
||||
const QueryResult = ({ value, width }) => {
|
||||
const QueryResult = ({ item, collection, value, width }) => {
|
||||
const {
|
||||
storedTheme
|
||||
} = useTheme();
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const onRun = () => dispatch(sendRequest(item, collection.uid));
|
||||
|
||||
return (
|
||||
<StyledWrapper className="px-3 w-full" style={{ maxWidth: width }}>
|
||||
<div className="h-full">
|
||||
<CodeEditor theme={storedTheme} value={value || ''} readOnly />
|
||||
<CodeEditor theme={storedTheme} onRun={onRun} value={value || ''} readOnly />
|
||||
</div>
|
||||
</StyledWrapper>
|
||||
);
|
||||
|
@ -33,7 +33,12 @@ const ResponsePane = ({ rightPaneWidth, item, collection }) => {
|
||||
const getTabPanel = (tab) => {
|
||||
switch (tab) {
|
||||
case 'response': {
|
||||
return <QueryResult width={rightPaneWidth} value={response.data ? JSON.stringify(response.data, null, 2) : ''} />;
|
||||
return <QueryResult
|
||||
item={item}
|
||||
collection={collection}
|
||||
width={rightPaneWidth}
|
||||
value={response.data ? JSON.stringify(response.data, null, 2) : ''
|
||||
} />;
|
||||
}
|
||||
case 'headers': {
|
||||
return <ResponseHeaders headers={response.headers} />;
|
||||
|
Loading…
Reference in New Issue
Block a user