Browse Source

fix: handle item creation and update #1117

Jacky 3 weeks ago
parent
commit
b5414d8222
1 changed files with 3 additions and 1 deletions
  1. 3 1
      app/src/views/certificate/CertificateEditor.vue

+ 3 - 1
app/src/views/certificate/CertificateEditor.vue

@@ -43,7 +43,9 @@ const errors = ref({}) as Ref<Record<string, string>>
 
 
 async function save() {
 async function save() {
   try {
   try {
-    const r = await cert.updateItem(data.value.id, data.value)
+    const r = data.value.id
+      ? await cert.updateItem(data.value.id, data.value)
+      : await cert.createItem(data.value)
     data.value = r
     data.value = r
     errors.value = {}
     errors.value = {}
     message.success($gettext('Save successfully'))
     message.success($gettext('Save successfully'))