Skip to content

Commit

Permalink
Merge branch 'master' of github.com:piccolo-orm/piccolo_admin
Browse files Browse the repository at this point in the history
  • Loading branch information
dantownsend committed May 2, 2024
2 parents b9722d6 + 93b5949 commit 5e8e96d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
13 changes: 6 additions & 7 deletions admin_ui/src/components/FormAdd.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import { defineComponent, type PropType } from "vue"
import NewForm from "./NewForm.vue"
import type { APIResponseMessage, FormConfig, Schema } from "../interfaces"
import { parseErrorResponse } from "../utils"
import { convertFormValue, parseErrorResponse } from "@/utils"
import FormErrors from "./FormErrors.vue"
const BASE_URL = import.meta.env.VITE_APP_BASE_URI
Expand Down Expand Up @@ -100,12 +100,11 @@ export default defineComponent({
const key = i[0]
let value: any = i[1]
if (value == "null") {
value = null
} else if (this.schema.properties[key].type == "array") {
value = JSON.parse(value)
}
json[key] = value
json[key] = convertFormValue({
key,
value,
schema: this.schema
})
}
try {
Expand Down
2 changes: 1 addition & 1 deletion admin_ui/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export function convertFormValue(params: {

if (value == "null") {
value = null
} else if (property.extra.nullable && value == "") {
} else if (property.extra?.nullable && value == "") {
value = null
} else if (getType(property) == "array") {
value = JSON.parse(String(value))
Expand Down

0 comments on commit 5e8e96d

Please sign in to comment.