-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1184 from smebberson/feature/clear-response
You can now clear a response.
- Loading branch information
Showing
4 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
packages/bruno-app/src/components/ResponsePane/ResponseClear/StyledWrapper.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import styled from 'styled-components'; | ||
|
||
const StyledWrapper = styled.div` | ||
font-size: 0.8125rem; | ||
color: ${(props) => props.theme.requestTabPanel.responseStatus}; | ||
`; | ||
|
||
export default StyledWrapper; |
28 changes: 28 additions & 0 deletions
28
packages/bruno-app/src/components/ResponsePane/ResponseClear/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React from 'react'; | ||
import { IconEraser } from '@tabler/icons'; | ||
import { useDispatch } from 'react-redux'; | ||
import StyledWrapper from './StyledWrapper'; | ||
import { responseReceived } from 'providers/ReduxStore/slices/collections/index'; | ||
|
||
const ResponseClear = ({ collection, item }) => { | ||
const dispatch = useDispatch(); | ||
const response = item.response || {}; | ||
|
||
const clearResponse = () => | ||
dispatch( | ||
responseReceived({ | ||
itemUid: item.uid, | ||
collectionUid: collection.uid, | ||
response: null | ||
}) | ||
); | ||
|
||
return ( | ||
<StyledWrapper className="ml-2 flex items-center"> | ||
<button onClick={clearResponse} disabled={!response.dataBuffer} title="Clear response"> | ||
<IconEraser size={16} strokeWidth={1.5} /> | ||
</button> | ||
</StyledWrapper> | ||
); | ||
}; | ||
export default ResponseClear; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters