mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-24 08:53:30 +01:00
feat: remove request headers
This commit is contained in:
parent
d7c3779e14
commit
d89ae537c1
1057
package-lock.json
generated
1057
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -7,6 +7,7 @@
|
||||
],
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.16.0",
|
||||
"@babel/plugin-transform-spread": "^7.16.7",
|
||||
"@babel/preset-env": "^7.16.4",
|
||||
"@babel/preset-react": "^7.16.0",
|
||||
"@babel/runtime": "^7.16.3",
|
||||
|
@ -2,5 +2,10 @@
|
||||
"presets": [
|
||||
"@babel/preset-env",
|
||||
["@babel/preset-react", {"runtime": "automatic"}]
|
||||
],
|
||||
"plugins": [
|
||||
["@babel/plugin-transform-spread", {
|
||||
"loose": true
|
||||
}]
|
||||
]
|
||||
}
|
@ -29,6 +29,7 @@
|
||||
"codemirror": "^5.64.0",
|
||||
"escape-html": "^1.0.3",
|
||||
"markdown-it": "^12.2.0",
|
||||
"nanoid": "^3.1.30",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2",
|
||||
"react-tabs": "^3.2.3",
|
||||
|
@ -1,15 +1,22 @@
|
||||
import React, { useState } from 'react';
|
||||
import { nanoid } from 'nanoid';
|
||||
import StyledWrapper from './StyledWrapper';
|
||||
|
||||
const initialState = [{
|
||||
uid: nanoid(),
|
||||
enabled: true
|
||||
}];
|
||||
|
||||
const RequestHeaders = () => {
|
||||
const [headers, setHeaders] = useState([{enabled: true}]);
|
||||
const [headers, setHeaders] = useState(initialState);
|
||||
|
||||
const addHeader = () => {
|
||||
let newHeader = {
|
||||
uid: nanoid(),
|
||||
key: '',
|
||||
value: '',
|
||||
description: '',
|
||||
enabled: true,
|
||||
enabled: true
|
||||
};
|
||||
|
||||
let newHeaders = [...headers, newHeader];
|
||||
@ -22,7 +29,7 @@ const RequestHeaders = () => {
|
||||
|
||||
const handleRemoveHeader = (index) => {
|
||||
headers.splice(index, 1);
|
||||
setHeaders(...headers);
|
||||
setHeaders([...headers]);
|
||||
};
|
||||
|
||||
return (
|
||||
@ -40,7 +47,7 @@ const RequestHeaders = () => {
|
||||
<tbody>
|
||||
{headers && headers.length && headers.map((header, index) => {
|
||||
return (
|
||||
<tr key={index}>
|
||||
<tr key={header.uid}>
|
||||
<td>
|
||||
<input
|
||||
type="checkbox"
|
||||
@ -79,7 +86,7 @@ const RequestHeaders = () => {
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
)
|
||||
);
|
||||
})}
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -40,6 +40,7 @@ module.exports = {
|
||||
'graphql': 'graphql',
|
||||
'escape-html': 'escape-html',
|
||||
'markdown-it': 'markdown-it',
|
||||
'nanoid': 'nanoid',
|
||||
'graphql-request': 'graphql-request'
|
||||
},
|
||||
plugins: [
|
||||
|
Loading…
Reference in New Issue
Block a user