Commit 1cfebb1d authored by 张烨's avatar 张烨

style: fix lint

parent 0d870f22
......@@ -4,5 +4,6 @@
"useTabs": false,
"semi": true,
"singleQuote": true,
"trailingComma": "all"
"trailingComma": "all",
"endOfLine": "auto"
}
......@@ -19,21 +19,25 @@ const RequestTest = () => {
const params =
values.params &&
values.params.reduce((param, { key, value }) => {
// eslint-disable-next-line no-param-reassign
param[key.trim()] = value.trim();
return param;
}, {});
if (window.location.host === values.url) {
methodMap[method](url, params).catch(err => {
console.error(err);
});
// eslint-disable-next-line no-console
console.error(err);
});
} else {
const proxyUrl = url.replace(/^https?:\/\/([^\/]+)/, $1 => {
return `${window.location.origin}`;
const proxyUrl = url.replace(
// eslint-disable-next-line no-useless-escape
/^https?:\/\/([^\/]+)/,
() => `${window.location.origin}`,
);
methodMap[method](proxyUrl, params).catch(err => {
// eslint-disable-next-line no-console
console.error(err);
});
methodMap[method](proxyUrl, params)
.catch(err => {
console.error(err);
});
}
};
......@@ -41,21 +45,14 @@ const RequestTest = () => {
setprotocal(v);
};
const handleKeyChange = (v, field) => {
console.log(form);
};
const handleValueChange = (v, field) => {
console.log(form);
};
const protocalBefore = (
<Select
defaultValue="http://"
className="select-before"
onChange={handleProtoSelectChange}
>
<Option value="http://">http://</Option>
<Option value="https://">https://</Option>
<Select.Option value="http://">http://</Select.Option>
<Select.Option value="https://">https://</Select.Option>
</Select>
);
......@@ -83,47 +80,45 @@ const RequestTest = () => {
<Select options={methods} />
</Form.Item>
<Form.List name="params">
{(fields, { add, remove }) => {
return (
<>
{fields.map(field => (
<Space key={field.key} align="start">
<Form.Item
{...field}
label={`key`}
name={[field.name, 'key']}
fieldKey={[field.fieldKey, 'key']}
rules={[{ required: true, message: 'Missing key' }]}
>
<Input onChange={v => handleKeyChange(v, field)} />
</Form.Item>
<Form.Item
{...field}
label={`value`}
fieldKey={[field.fieldKey, 'value']}
name={[field.name, 'value']}
>
<Input onChange={v => handleValueChange(v, field)} />
</Form.Item>
<MinusCircleOutlined
onClick={() => console.log(field) || remove(field.name)}
/>
</Space>
))}
<Form.Item>
<Button
type="dashed"
onClick={() => {
add();
}}
block
{(fields, { add, remove }) => (
<>
{fields.map(field => (
<Space key={field.key} align="start">
<Form.Item
{...field}
label="key"
name={[field.name, 'key']}
fieldKey={[field.fieldKey, 'key']}
rules={[{ required: true, message: 'Missing key' }]}
>
<Input />
</Form.Item>
<Form.Item
{...field}
label="value"
fieldKey={[field.fieldKey, 'value']}
name={[field.name, 'value']}
>
<PlusOutlined /> Add params
</Button>
</Form.Item>
</>
);
}}
<Input />
</Form.Item>
<MinusCircleOutlined
onClick={() => console.log(field) || remove(field.name)}
/>
</Space>
))}
<Form.Item>
<Button
type="dashed"
onClick={() => {
add();
}}
block
>
<PlusOutlined /> Add params
</Button>
</Form.Item>
</>
)}
</Form.List>
<Form.Item>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment