Browse Source

fix(gui-v2): pass attachment and LTAR data properly

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/3188/head
Pranav C 2 years ago
parent
commit
c1dca10aca
  1. 6
      packages/nc-gui-v2/composables/useSharedFormViewStore.ts

6
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<string, any>, additionalState: Record<string, any>) => {
const submitForm = async () => {
try {
if (!(await v$.value?.$validate())) {
return
}
progress.value = true
const data = { ...formState, ...additionalState }
const data:Record<string,any> = { ...(formState?.value ?? {}), ...(additionalState?.value || {}) }
const attachment: Record<string, any> = {}
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

Loading…
Cancel
Save