mirror of
https://github.com/langgenius/dify.git
synced 2026-04-27 11:06:46 +08:00
fix: change to key value type not show init key values
This commit is contained in:
parent
2a6629d435
commit
dae62bef78
@ -63,9 +63,19 @@ const EditBody: FC<Props> = ({
|
|||||||
|
|
||||||
const handleTypeChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {
|
const handleTypeChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
const newType = e.target.value as BodyType
|
const newType = e.target.value as BodyType
|
||||||
|
const hasKeyValue = [BodyType.formData, BodyType.xWwwFormUrlencoded].includes(newType)
|
||||||
onChange({
|
onChange({
|
||||||
type: newType,
|
type: newType,
|
||||||
data: [],
|
data: hasKeyValue
|
||||||
|
? [
|
||||||
|
{
|
||||||
|
id: uniqueId(UNIQUE_ID_PREFIX),
|
||||||
|
type: BodyPayloadValueType.text,
|
||||||
|
key: '',
|
||||||
|
value: '',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
: [],
|
||||||
})
|
})
|
||||||
}, [onChange])
|
}, [onChange])
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user