Prechádzať zdrojové kódy

fix: handle item creation and update #1117

Jacky 1 mesiac pred
rodič
commit
b5414d8222

+ 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'))