mirror of
https://github.com/hexastack/hexabot
synced 2025-01-22 18:45:57 +00:00
fix: convert stringified numbers to Number before making http request
This commit is contained in:
parent
9a3165f8da
commit
dd4ad54d58
@ -133,8 +133,14 @@ export const Settings = () => {
|
||||
useEffect(() => {
|
||||
const subscription = watch((values, { name }) => {
|
||||
const [group, label] = (name as string).split(".");
|
||||
const currentSettingValue = values[group][label] as any;
|
||||
// if setting value is Number but typed string convert it to number
|
||||
const settingValue =
|
||||
typeof values[group][label] === "string" && isNaN(currentSettingValue)
|
||||
? values[group][label]
|
||||
: Number(values[group][label]);
|
||||
|
||||
debouncedUpdate(group, label, values[group][label]);
|
||||
debouncedUpdate(group, label, settingValue);
|
||||
});
|
||||
|
||||
return () => {
|
||||
|
Loading…
Reference in New Issue
Block a user