Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions adminforth/spa/src/components/ResourceForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ const columnError = (column: AdminForthResourceColumnCommon) => {
if (column.type === 'json' && !column.isArray?.enabled && currentValues.value[column.name]) {
const value = currentValues.value[column.name];
try {
// add object check to allow json fields to be objects in edit mode without throwing validation error, but still validate if the string is a valid json or not
if (typeof value === 'object') {
JSON.parse(JSON.stringify(value));
}
Expand Down Expand Up @@ -289,6 +290,8 @@ onMounted(() => {
}
}
} else if (currentValues.value[column.name]) {
// Todo: reconsider basic issue
// if value is not string, we should stringify it, but object we already stringify in setCurrentValue, so we should not stringify it again to prevent double stringification
if (typeof currentValues.value[column.name] !== 'string') {
currentValues.value[column.name] = JSON.stringify(currentValues.value[column.name], null, 2)
}
Expand Down