Skip to content

Commit 40be991

Browse files
committed
remove empty string arrays
1 parent b17cf2e commit 40be991

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

web/static/config/edit.html

+11
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,17 @@
139139
alert('Error: cannot edit defaults');
140140
} else {
141141
const value = editor.getValue();
142+
function cleanEmptyArrays(json) {
143+
if (Array.isArray(json)) {
144+
return json.filter(item => item !== ""); // Remove empty strings from arrays
145+
} else if (typeof json === "object" && json !== null) {
146+
Object.keys(json).forEach(key => {
147+
json[key] = cleanEmptyArrays(json[key]); // Recursively clean nested structures
148+
});
149+
}
150+
return json;
151+
}
152+
cleanEmptyArrays(value);
142153
console.log(value)
143154
axios.post('/api/config/layers/' + layer, value)
144155
.then(response => {

0 commit comments

Comments
 (0)