update empty string to null
This commit is contained in:
@@ -7,8 +7,8 @@
|
||||
<q-btn
|
||||
rounded color="primary"
|
||||
class="w100 q-mt-md q-mb-xs"
|
||||
:disable="!(isFormValid && (isDirty(initialCompany, modelValue)))"
|
||||
@click = "emit('update')"
|
||||
:disable="!isFormValid"
|
||||
@click = "onSubmit"
|
||||
>
|
||||
{{ $t(btnText) }}
|
||||
</q-btn>
|
||||
@@ -57,10 +57,10 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import {onMounted, computed, ref } from 'vue'
|
||||
import { computed } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { isDirty } from 'helpers/helpers'
|
||||
import type { CompanyParams } from 'types/Company'
|
||||
import { convertEmptyStringsToNull } from 'helpers/helpers'
|
||||
|
||||
const { t }= useI18n()
|
||||
|
||||
@@ -108,13 +108,11 @@
|
||||
return Object.values(validations).every(Boolean)
|
||||
})
|
||||
|
||||
const initialCompany = ref({} as CompanyParams)
|
||||
function onSubmit() {
|
||||
const cleanedData = convertEmptyStringsToNull(modelValue.value)
|
||||
emit('update', cleanedData)
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
console.log(111, modelValue.value)
|
||||
initialCompany.value = { ...modelValue.value }
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
Reference in New Issue
Block a user