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

style: fix lint

parent 0d870f22
...@@ -4,5 +4,6 @@ ...@@ -4,5 +4,6 @@
"useTabs": false, "useTabs": false,
"semi": true, "semi": true,
"singleQuote": true, "singleQuote": true,
"trailingComma": "all" "trailingComma": "all",
"endOfLine": "auto"
} }
...@@ -19,21 +19,25 @@ const RequestTest = () => { ...@@ -19,21 +19,25 @@ const RequestTest = () => {
const params = const params =
values.params && values.params &&
values.params.reduce((param, { key, value }) => { values.params.reduce((param, { key, value }) => {
// eslint-disable-next-line no-param-reassign
param[key.trim()] = value.trim(); param[key.trim()] = value.trim();
return param; return param;
}, {}); }, {});
if (window.location.host === values.url) { if (window.location.host === values.url) {
methodMap[method](url, params).catch(err => { methodMap[method](url, params).catch(err => {
console.error(err); // eslint-disable-next-line no-console
}); console.error(err);
});
} else { } else {
const proxyUrl = url.replace(/^https?:\/\/([^\/]+)/, $1 => { const proxyUrl = url.replace(
return `${window.location.origin}`; // 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 = () => { ...@@ -41,21 +45,14 @@ const RequestTest = () => {
setprotocal(v); setprotocal(v);
}; };
const handleKeyChange = (v, field) => {
console.log(form);
};
const handleValueChange = (v, field) => {
console.log(form);
};
const protocalBefore = ( const protocalBefore = (
<Select <Select
defaultValue="http://" defaultValue="http://"
className="select-before" className="select-before"
onChange={handleProtoSelectChange} onChange={handleProtoSelectChange}
> >
<Option value="http://">http://</Option> <Select.Option value="http://">http://</Select.Option>
<Option value="https://">https://</Option> <Select.Option value="https://">https://</Select.Option>
</Select> </Select>
); );
...@@ -83,47 +80,45 @@ const RequestTest = () => { ...@@ -83,47 +80,45 @@ const RequestTest = () => {
<Select options={methods} /> <Select options={methods} />
</Form.Item> </Form.Item>
<Form.List name="params"> <Form.List name="params">
{(fields, { add, remove }) => { {(fields, { add, remove }) => (
return ( <>
<> {fields.map(field => (
{fields.map(field => ( <Space key={field.key} align="start">
<Space key={field.key} align="start"> <Form.Item
<Form.Item {...field}
{...field} label="key"
label={`key`} name={[field.name, 'key']}
name={[field.name, 'key']} fieldKey={[field.fieldKey, 'key']}
fieldKey={[field.fieldKey, 'key']} rules={[{ required: true, message: 'Missing key' }]}
rules={[{ required: true, message: 'Missing key' }]} >
> <Input />
<Input onChange={v => handleKeyChange(v, field)} /> </Form.Item>
</Form.Item> <Form.Item
<Form.Item {...field}
{...field} label="value"
label={`value`} fieldKey={[field.fieldKey, 'value']}
fieldKey={[field.fieldKey, 'value']} name={[field.name, '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
> >
<PlusOutlined /> Add params <Input />
</Button> </Form.Item>
</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.List>
<Form.Item> <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