update empty string to null
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="flex row items-center">
|
||||
<div class="flex row items-center no-wrap">
|
||||
<svg
|
||||
class="iconcolor q-mr-sm"
|
||||
class="iconcolor q-mr-xs"
|
||||
viewBox="0 0 8.4666662 8.4666662"
|
||||
width="32"
|
||||
height="32"
|
||||
@@ -68,12 +68,17 @@
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
<span class="text-h4 q-pa-0" style="color: var(--logo-color-bg-white);">
|
||||
projects
|
||||
<span
|
||||
class="text-h4 text-brand"
|
||||
style="
|
||||
color: var(--logo-color-bg-white);
|
||||
margin-right: 2px;"
|
||||
>
|
||||
tg
|
||||
</span>
|
||||
|
||||
<span class="text-h4 text-brand text-bold q-pa-0">
|
||||
Node
|
||||
<span class="text-h4 text-brand2 text-bold q-pa-0">
|
||||
Crew
|
||||
</span>
|
||||
|
||||
</div>
|
||||
@@ -99,16 +104,16 @@
|
||||
}
|
||||
|
||||
.iconcolor {
|
||||
--icon-color: var(--logo-color-bg-white);
|
||||
--icon-color: #27A7E7;
|
||||
}
|
||||
|
||||
@keyframes blink {
|
||||
100%,
|
||||
0% {
|
||||
fill: $light-green-14;
|
||||
fill: #fa9e7a;
|
||||
}
|
||||
60% {
|
||||
fill: $green-14;
|
||||
fill: #F36D3A;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,7 +126,6 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, computed } from 'vue'
|
||||
import type { AxiosError } from 'axios'
|
||||
import { useQuasar } from 'quasar'
|
||||
import { useI18n } from "vue-i18n"
|
||||
import { QInput } from 'quasar'
|
||||
import { useAuthStore, type AuthFlowType } from 'stores/auth'
|
||||
@@ -141,7 +140,6 @@
|
||||
: 'changeMethod'
|
||||
})
|
||||
|
||||
const $q = useQuasar()
|
||||
const { t } = useI18n()
|
||||
const authStore = useAuthStore()
|
||||
|
||||
@@ -178,34 +176,17 @@
|
||||
})
|
||||
|
||||
const stepActions: Record<Step, () => Promise<void>> = {
|
||||
1: async () => {
|
||||
await authStore.initRegistration(flowType.value, login.value)
|
||||
},
|
||||
2: async () => {
|
||||
await authStore.confirmCode(flowType.value, login.value, code.value)
|
||||
},
|
||||
3: async () => {
|
||||
await authStore.setPassword(flowType.value, login.value, code.value, password.value)
|
||||
if (flowType.value === 'register' || flowType.value === 'changeMethod') {
|
||||
await authStore.loginWithCredentials(login.value, password.value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const handleError = (err: AxiosError) => {
|
||||
const error = err as AxiosError<{ error?: { message?: string } }>
|
||||
const message = error.response?.data?.error?.message || t('unknown_error')
|
||||
|
||||
$q.notify({
|
||||
message: `${t('error')}: ${message}`,
|
||||
type: 'negative',
|
||||
position: 'bottom',
|
||||
timeout: 2500
|
||||
})
|
||||
|
||||
if (step.value > 1) {
|
||||
code.value = ''
|
||||
password.value = ''
|
||||
1: async () => {
|
||||
await authStore.initRegistration(flowType.value, login.value)
|
||||
},
|
||||
2: async () => {
|
||||
await authStore.confirmCode(flowType.value, login.value, code.value)
|
||||
},
|
||||
3: async () => {
|
||||
await authStore.setPassword(flowType.value, login.value, code.value, password.value)
|
||||
if (flowType.value === 'register' || flowType.value === 'changeMethod') {
|
||||
await authStore.loginWithCredentials(login.value, password.value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,7 +199,7 @@
|
||||
showSuccessOverlay.value = true
|
||||
}
|
||||
} catch (error) {
|
||||
handleError(error as AxiosError)
|
||||
console.error(error as AxiosError)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<q-btn
|
||||
rounded color="primary"
|
||||
class="w100 q-mt-md q-mb-xs"
|
||||
:disable="!(isFormValid && (isDirty(initialProject, modelValue)))"
|
||||
:disable="!isFormValid"
|
||||
@click = "emit('update')"
|
||||
>
|
||||
{{ $t(btnText) }}
|
||||
@@ -64,7 +64,6 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, computed, ref } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { isDirty } from 'helpers/helpers'
|
||||
import type { ProjectParams } from 'types/Project'
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user