mirror of
https://github.com/whyour/qinglong.git
synced 2026-07-01 04:40:38 +08:00
修复自定义通知
This commit is contained in:
@@ -2,6 +2,7 @@ import React, { useEffect, useState } from 'react';
|
||||
import { Typography, Input, Form, Button, Select, message } from 'antd';
|
||||
import { request } from '@/utils/http';
|
||||
import config from '@/utils/config';
|
||||
import { parseBody, parseHeaders } from '@/utils';
|
||||
|
||||
const { Option } = Select;
|
||||
|
||||
@@ -12,9 +13,15 @@ const NotificationSetting = ({ data }: any) => {
|
||||
const [form] = Form.useForm();
|
||||
|
||||
const handleOk = (values: any) => {
|
||||
if (values.type == 'closed') {
|
||||
const { type, webhookBody, webhookContentType } = values;
|
||||
if (type == 'closed') {
|
||||
values.type = '';
|
||||
}
|
||||
|
||||
if (type === 'webhook') {
|
||||
values.webhookHeaders = { ...parseHeaders(values.webhookHeaders) };
|
||||
values.webhookBody = parseBody(webhookBody, webhookContentType);
|
||||
}
|
||||
request
|
||||
.put(`${config.apiPrefix}user/notification`, {
|
||||
data: {
|
||||
@@ -73,10 +80,22 @@ const NotificationSetting = ({ data }: any) => {
|
||||
rules={[{ required: x.required }]}
|
||||
style={{ maxWidth: 400 }}
|
||||
>
|
||||
<Input.TextArea
|
||||
autoSize={true}
|
||||
placeholder={x.placeholder || `请输入${x.label}`}
|
||||
/>
|
||||
{
|
||||
x.items ? (
|
||||
<Select placeholder={x.placeholder || `请选择${x.label}`}>
|
||||
{x.items.map((y) => (
|
||||
<Option key={y.value} value={y.value}>
|
||||
{y.label || y.value}
|
||||
</Option>
|
||||
))}
|
||||
</Select>
|
||||
) : (
|
||||
<Input.TextArea
|
||||
autoSize={true}
|
||||
placeholder={x.placeholder || `请输入${x.label}`}
|
||||
/>
|
||||
)
|
||||
}
|
||||
</Form.Item>
|
||||
))}
|
||||
<Button type="primary" htmlType="submit">
|
||||
|
||||
Reference in New Issue
Block a user