diff --git a/packages/nc-gui-v2/components/api-client/Headers.vue b/packages/nc-gui-v2/components/api-client/Headers.vue index 6111e18681..e465ffcdfc 100644 --- a/packages/nc-gui-v2/components/api-client/Headers.vue +++ b/packages/nc-gui-v2/components/api-client/Headers.vue @@ -6,18 +6,11 @@ interface Props { modelValue: Record[] } -const { modelValue } = defineProps() +const props = defineProps() -const emit = defineEmits(['update:modelValue']) +const emits = defineEmits(['update:modelValue']) -const localState = computed({ - get() { - return modelValue - }, - set(newValue: Record[]) { - emit('update:modelValue', newValue) - }, -}) +const vModel = useVModel(props, 'modelValue', emits) const headerList = ref([ 'A-IM', @@ -61,9 +54,9 @@ const headerList = ref([ 'X-CSRF-Token', ]) -const addHeaderRow = () => localState.value.push({}) +const addHeaderRow = () => vModel.value.push({}) -const deleteHeaderRow = (idx: number) => localState.value.splice(idx, 1) +const deleteHeaderRow = (idx: number) => vModel.value.splice(idx, 1)