mirror of
https://github.com/usebruno/bruno.git
synced 2025-06-23 13:31:43 +02:00
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 React from 'react';
|
||||||
import CodeEditor from 'components/CodeEditor';
|
import CodeEditor from 'components/CodeEditor';
|
||||||
import { useTheme } from 'providers/Theme';
|
import { useTheme } from 'providers/Theme';
|
||||||
|
import { useDispatch } from 'react-redux';
|
||||||
|
import { sendRequest } from 'providers/ReduxStore/slices/collections/actions';
|
||||||
|
|
||||||
import StyledWrapper from './StyledWrapper';
|
import StyledWrapper from './StyledWrapper';
|
||||||
|
|
||||||
const QueryResult = ({ value, width }) => {
|
const QueryResult = ({ item, collection, value, width }) => {
|
||||||
const {
|
const {
|
||||||
storedTheme
|
storedTheme
|
||||||
} = useTheme();
|
} = useTheme();
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
|
const onRun = () => dispatch(sendRequest(item, collection.uid));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledWrapper className="px-3 w-full" style={{ maxWidth: width }}>
|
<StyledWrapper className="px-3 w-full" style={{ maxWidth: width }}>
|
||||||
<div className="h-full">
|
<div className="h-full">
|
||||||
<CodeEditor theme={storedTheme} value={value || ''} readOnly />
|
<CodeEditor theme={storedTheme} onRun={onRun} value={value || ''} readOnly />
|
||||||
</div>
|
</div>
|
||||||
</StyledWrapper>
|
</StyledWrapper>
|
||||||
);
|
);
|
||||||
|
@ -33,7 +33,12 @@ const ResponsePane = ({ rightPaneWidth, item, collection }) => {
|
|||||||
const getTabPanel = (tab) => {
|
const getTabPanel = (tab) => {
|
||||||
switch (tab) {
|
switch (tab) {
|
||||||
case 'response': {
|
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': {
|
case 'headers': {
|
||||||
return <ResponseHeaders headers={response.headers} />;
|
return <ResponseHeaders headers={response.headers} />;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user