Browse Source

fix(gui-v2): wrap saveOrUpdate by isUIAllowed('fieldsSync')

pull/3087/head
Wing-Kam Wong 2 years ago
parent
commit
39ec6bd010
  1. 12
      packages/nc-gui-v2/composables/useViewColumns.ts

12
packages/nc-gui-v2/composables/useViewColumns.ts

@ -24,6 +24,8 @@ export function useViewColumns(
const { $api } = useNuxtApp()
const { isUIAllowed } = useUIPermission()
const loadViewColumns = async () => {
if (!meta || !view) return
@ -88,10 +90,12 @@ export function useViewColumns(
}
const saveOrUpdate = async (field: any, index: number) => {
if (field.id && view?.value?.id) {
await $api.dbViewColumn.update(view.value.id, field.id, field)
} else if (view?.value?.id) {
if (fields.value) fields.value[index] = (await $api.dbViewColumn.create(view.value.id, field)) as any
if (isUIAllowed('fieldsSync')) {
if (field.id && view?.value?.id) {
await $api.dbViewColumn.update(view.value.id, field.id, field)
} else if (view?.value?.id) {
if (fields.value) fields.value[index] = (await $api.dbViewColumn.create(view.value.id, field)) as any
}
}
reloadData?.()

Loading…
Cancel
Save