From c1dca10aca7a4083137662bdd77ea5c1a4c10e1e Mon Sep 17 00:00:00 2001 From: Pranav C Date: Wed, 17 Aug 2022 13:50:41 +0530 Subject: [PATCH] fix(gui-v2): pass attachment and LTAR data properly Signed-off-by: Pranav C --- packages/nc-gui-v2/composables/useSharedFormViewStore.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/nc-gui-v2/composables/useSharedFormViewStore.ts b/packages/nc-gui-v2/composables/useSharedFormViewStore.ts index 6518b621dc..d8eff629a7 100644 --- a/packages/nc-gui-v2/composables/useSharedFormViewStore.ts +++ b/packages/nc-gui-v2/composables/useSharedFormViewStore.ts @@ -106,16 +106,17 @@ const [useProvideSharedFormStore, useSharedFormStore] = useInjectionState((share computed(() => ({ localState: formState?.value, virtual: additionalState?.value })), ) - const submitForm = async (formState: Record, additionalState: Record) => { + const submitForm = async () => { try { if (!(await v$.value?.$validate())) { return } progress.value = true - const data = { ...formState, ...additionalState } + const data:Record = { ...(formState?.value ?? {}), ...(additionalState?.value || {}) } const attachment: Record = {} + for (const col of metas?.value?.[sharedFormView?.value?.fk_model_id as string]?.columns ?? []) { if (col.uidt === UITypes.Attachment) { attachment[`_${col.title}`] = data[col.title!] @@ -142,7 +143,6 @@ const [useProvideSharedFormStore, useSharedFormStore] = useInjectionState((share await message.success(sharedFormView.value?.success_msg || 'Saved successfully.') } catch (e: any) { console.log(e) - throw e await message.error(await extractSdkResponseErrorMsg(e)) } progress.value = false