mirror of
https://github.com/logto-io/logto.git
synced 2025-03-10 22:22:45 -05:00
fix(console): ignore empty number input box in connector config (#3822)
This commit is contained in:
parent
e62b0bae5e
commit
a65bc9b13b
4 changed files with 17 additions and 2 deletions
5
.changeset/heavy-sloths-enjoy.md
Normal file
5
.changeset/heavy-sloths-enjoy.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"@logto/console": patch
|
||||
---
|
||||
|
||||
Should ignore empty number input box when parsing connector config form.
|
5
.changeset/lemon-bears-reply.md
Normal file
5
.changeset/lemon-bears-reply.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"@logto/connector-saml": patch
|
||||
---
|
||||
|
||||
Should use placeholder instead of default value.
|
|
@ -145,7 +145,7 @@ export const formItems: ConnectorConfigFormItem[] = [
|
|||
type: ConnectorConfigFormItemType.Number,
|
||||
label: 'Timeout',
|
||||
key: 'timeout',
|
||||
defaultValue: 5000,
|
||||
placeholder: '5000',
|
||||
},
|
||||
{
|
||||
type: ConnectorConfigFormItemType.Json,
|
||||
|
|
|
@ -38,8 +38,13 @@ export const parseFormConfig = (data: ConnectorFormType, formItems: ConnectorCon
|
|||
}
|
||||
|
||||
if (formItem.type === ConnectorConfigFormItemType.Number) {
|
||||
/**
|
||||
* When set ReactHookForm valueAsNumber to true, the number input field
|
||||
* will return number value. If the input can not be properly converted
|
||||
* to number value, it will return NaN instead.
|
||||
*/
|
||||
// The number input my return string value.
|
||||
return [key, Number(value)];
|
||||
return Number.isNaN(value) ? null : [key, Number(value)];
|
||||
}
|
||||
|
||||
if (formItem.type === ConnectorConfigFormItemType.Json) {
|
||||
|
|
Loading…
Add table
Reference in a new issue