fix: improve boolean field handling in plugin configuration forms (#23160)
Co-authored-by: crazywoola <427733928@qq.com>
This commit is contained in:
@@ -47,7 +47,22 @@ const EndpointModal: FC<Props> = ({
|
||||
return
|
||||
}
|
||||
}
|
||||
onSaved(tempCredential)
|
||||
|
||||
// Fix: Process boolean fields to ensure they are sent as proper boolean values
|
||||
const processedCredential = { ...tempCredential }
|
||||
formSchemas.forEach((field) => {
|
||||
if (field.type === 'boolean' && processedCredential[field.name] !== undefined) {
|
||||
const value = processedCredential[field.name]
|
||||
if (typeof value === 'string')
|
||||
processedCredential[field.name] = value === 'true' || value === '1' || value === 'True'
|
||||
else if (typeof value === 'number')
|
||||
processedCredential[field.name] = value === 1
|
||||
else if (typeof value === 'boolean')
|
||||
processedCredential[field.name] = value
|
||||
}
|
||||
})
|
||||
|
||||
onSaved(processedCredential)
|
||||
}
|
||||
|
||||
return (
|
||||
|
Reference in New Issue
Block a user