Skip to content

Commit 5e8e96d

Browse files
committed
Merge branch 'master' of github.com:piccolo-orm/piccolo_admin
2 parents b9722d6 + 93b5949 commit 5e8e96d

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

admin_ui/src/components/FormAdd.vue

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ import { defineComponent, type PropType } from "vue"
4646
4747
import NewForm from "./NewForm.vue"
4848
import type { APIResponseMessage, FormConfig, Schema } from "../interfaces"
49-
import { parseErrorResponse } from "../utils"
49+
import { convertFormValue, parseErrorResponse } from "@/utils"
5050
import FormErrors from "./FormErrors.vue"
5151
5252
const BASE_URL = import.meta.env.VITE_APP_BASE_URI
@@ -100,12 +100,11 @@ export default defineComponent({
100100
const key = i[0]
101101
let value: any = i[1]
102102
103-
if (value == "null") {
104-
value = null
105-
} else if (this.schema.properties[key].type == "array") {
106-
value = JSON.parse(value)
107-
}
108-
json[key] = value
103+
json[key] = convertFormValue({
104+
key,
105+
value,
106+
schema: this.schema
107+
})
109108
}
110109
111110
try {

admin_ui/src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ export function convertFormValue(params: {
139139

140140
if (value == "null") {
141141
value = null
142-
} else if (property.extra.nullable && value == "") {
142+
} else if (property.extra?.nullable && value == "") {
143143
value = null
144144
} else if (getType(property) == "array") {
145145
value = JSON.parse(String(value))

0 commit comments

Comments
 (0)