mirror of
https://github.com/usebruno/bruno.git
synced 2025-01-18 20:08:50 +01:00
pr #1184: addressed review comments
This commit is contained in:
parent
2d16e07747
commit
ee2295aec1
@ -2,15 +2,14 @@ import React from 'react';
|
|||||||
import { IconEraser } from '@tabler/icons';
|
import { IconEraser } from '@tabler/icons';
|
||||||
import { useDispatch } from 'react-redux';
|
import { useDispatch } from 'react-redux';
|
||||||
import StyledWrapper from './StyledWrapper';
|
import StyledWrapper from './StyledWrapper';
|
||||||
import { responseReceived } from 'providers/ReduxStore/slices/collections/index';
|
import { responseCleared } from 'providers/ReduxStore/slices/collections/index';
|
||||||
|
|
||||||
const ResponseClear = ({ collection, item }) => {
|
const ResponseClear = ({ collection, item }) => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const response = item.response || {};
|
|
||||||
|
|
||||||
const clearResponse = () =>
|
const clearResponse = () =>
|
||||||
dispatch(
|
dispatch(
|
||||||
responseReceived({
|
responseCleared({
|
||||||
itemUid: item.uid,
|
itemUid: item.uid,
|
||||||
collectionUid: collection.uid,
|
collectionUid: collection.uid,
|
||||||
response: null
|
response: null
|
||||||
@ -19,7 +18,7 @@ const ResponseClear = ({ collection, item }) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledWrapper className="ml-2 flex items-center">
|
<StyledWrapper className="ml-2 flex items-center">
|
||||||
<button onClick={clearResponse} disabled={!response.dataBuffer} title="Clear response">
|
<button onClick={clearResponse} title="Clear response">
|
||||||
<IconEraser size={16} strokeWidth={1.5} />
|
<IconEraser size={16} strokeWidth={1.5} />
|
||||||
</button>
|
</button>
|
||||||
</StyledWrapper>
|
</StyledWrapper>
|
||||||
|
@ -269,6 +269,16 @@ export const collectionsSlice = createSlice({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
responseCleared: (state, action) => {
|
||||||
|
const collection = findCollectionByUid(state.collections, action.payload.collectionUid);
|
||||||
|
|
||||||
|
if (collection) {
|
||||||
|
const item = findItemInCollection(collection, action.payload.itemUid);
|
||||||
|
if (item) {
|
||||||
|
item.response = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
saveRequest: (state, action) => {
|
saveRequest: (state, action) => {
|
||||||
const collection = findCollectionByUid(state.collections, action.payload.collectionUid);
|
const collection = findCollectionByUid(state.collections, action.payload.collectionUid);
|
||||||
|
|
||||||
@ -1397,6 +1407,7 @@ export const {
|
|||||||
processEnvUpdateEvent,
|
processEnvUpdateEvent,
|
||||||
requestCancelled,
|
requestCancelled,
|
||||||
responseReceived,
|
responseReceived,
|
||||||
|
responseCleared,
|
||||||
saveRequest,
|
saveRequest,
|
||||||
deleteRequestDraft,
|
deleteRequestDraft,
|
||||||
newEphemeralHttpRequest,
|
newEphemeralHttpRequest,
|
||||||
|
Loading…
Reference in New Issue
Block a user