Explorar el Código

fix: handle item creation and update #1117

Jacky hace 1 mes
padre
commit
b5414d8222
Se han modificado 1 ficheros con 3 adiciones y 1 borrados
  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() {
   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
     errors.value = {}
     message.success($gettext('Save successfully'))