Let servers validate invalid input
This commit is contained in:
parent
a4f99bd5d0
commit
69c294c0ae
1 changed files with 7 additions and 1 deletions
|
|
@ -252,13 +252,19 @@ const ToolsTab = ({
|
||||||
[key]: undefined,
|
[key]: undefined,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// Field has value - convert to number (never store strings)
|
// Field has value - try to convert to number, but store input either way
|
||||||
const num = Number(value);
|
const num = Number(value);
|
||||||
if (!isNaN(num)) {
|
if (!isNaN(num)) {
|
||||||
setParams({
|
setParams({
|
||||||
...params,
|
...params,
|
||||||
[key]: num,
|
[key]: num,
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
// Store invalid input as string - let server validate
|
||||||
|
setParams({
|
||||||
|
...params,
|
||||||
|
[key]: value,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue