IO-2175 Category Dropdown Clear

Allow for clear and correct for Select allowClear sending undefined and convert that to null. Overload UndefinedtoNull to have an array of keys
This commit is contained in:
Allan Carr
2023-02-16 17:26:57 -08:00
parent 3650cacb51
commit ae4cff98e7
3 changed files with 8 additions and 3 deletions

View File

@@ -1,6 +1,10 @@
export default function UndefinedToNull(obj) {
export default function UndefinedToNull(obj, keys) {
Object.keys(obj).forEach((key) => {
if (keys && keys.indexOf(key) >= 0) {
if (obj[key] === undefined) obj[key] = null;
} else {
if (obj[key] === undefined) obj[key] = null;
}
});
return obj;
}