mirror of
https://github.com/LD-Reborn/Berufsschule_HAM.git
synced 2025-12-20 06:51:55 +00:00
Merge pull request #222 from LD-Reborn/200-bug-user-create-modal-fields-with-numeric-values-interpreted-as-int
Fixed numeric values in user create and update interpreted as int
This commit is contained in:
@@ -243,23 +243,22 @@
|
||||
let current = result;
|
||||
for (let i = 0; i < parts.length; i++) {
|
||||
const part = parts[i];
|
||||
|
||||
if (i === parts.length - 1) {
|
||||
// Last part — assign value
|
||||
try {
|
||||
// Try to parse JSON strings like "[...]" if possible
|
||||
current[part] = JSON.parse(value);
|
||||
} catch {
|
||||
if (typeof value === "string" && /^[\[{]/.test(value.trim())) {
|
||||
try {
|
||||
current[part] = JSON.parse(value);
|
||||
} catch {
|
||||
current[part] = value;
|
||||
}
|
||||
} else {
|
||||
current[part] = value;
|
||||
}
|
||||
} else {
|
||||
// Intermediate part — create object if needed
|
||||
current[part] = current[part] || {};
|
||||
current = current[part];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user