update empty string to null

This commit is contained in:
2025-07-28 18:17:52 +03:00
parent 6d71c60550
commit 462ed2b671
33 changed files with 369 additions and 242 deletions

View File

@@ -7,8 +7,7 @@
<q-btn
rounded color="primary"
class="w100 q-mt-md q-mb-xs"
:disable="!(isDirty(initialUser, modelValue))"
@click = "emit('update')"
@click = "onSubmit"
>
{{ $t(btnText) }}
</q-btn>
@@ -108,12 +107,13 @@
</template>
<script setup lang="ts">
import { onMounted, computed, ref } from 'vue'
import { computed } from 'vue'
import { useCompaniesStore } from 'stores/companies'
import { useI18n } from 'vue-i18n'
import { isDirty } from 'helpers/helpers'
import { convertEmptyStringsToNull } from 'src/helpers/helpers'
import type { User } from 'types/Users'
const { t } = useI18n()
const modelValue = defineModel<User>({
@@ -127,11 +127,10 @@
const emit = defineEmits(['update'])
const initialUser = ref({} as User)
onMounted(() => {
initialUser.value = { ...modelValue.value }
})
function onSubmit() {
const cleanedData = convertEmptyStringsToNull(modelValue.value)
emit('update', cleanedData)
}
const companiesStore = useCompaniesStore()
const companies = computed(() => companiesStore.companies)