update empty string to null
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user