update empty string to null
This commit is contained in:
@@ -192,12 +192,10 @@
|
||||
<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 } from 'stores/auth'
|
||||
|
||||
const $q = useQuasar()
|
||||
const { t } = useI18n()
|
||||
const authStore = useAuthStore()
|
||||
|
||||
@@ -231,39 +229,22 @@
|
||||
})
|
||||
|
||||
const stepActions: Record<Step, () => Promise<void>> = {
|
||||
1: async () => {
|
||||
await authStore.getCodeCurrentEmail()
|
||||
},
|
||||
2: async () => {
|
||||
await authStore.confirmCurrentEmailCode(code.value)
|
||||
console.log(code.value)
|
||||
},
|
||||
3: async () => {
|
||||
await authStore.getCodeNewEmail(code.value, newLogin.value)
|
||||
},
|
||||
4: async () => {
|
||||
await authStore.confirmNewEmailCode(code.value, newCode.value, newLogin.value,)
|
||||
},
|
||||
5: async () => {
|
||||
await authStore.setNewEmailPassword(code.value, newCode.value, newLogin.value, password.value)
|
||||
await authStore.loginWithCredentials(newLogin.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.getCodeCurrentEmail()
|
||||
},
|
||||
2: async () => {
|
||||
await authStore.confirmCurrentEmailCode(code.value)
|
||||
console.log(code.value)
|
||||
},
|
||||
3: async () => {
|
||||
await authStore.getCodeNewEmail(code.value, newLogin.value)
|
||||
},
|
||||
4: async () => {
|
||||
await authStore.confirmNewEmailCode(code.value, newCode.value, newLogin.value,)
|
||||
},
|
||||
5: async () => {
|
||||
await authStore.setNewEmailPassword(code.value, newCode.value, newLogin.value, password.value)
|
||||
await authStore.loginWithCredentials(newLogin.value, password.value)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -276,7 +257,7 @@
|
||||
showSuccessOverlay.value = true
|
||||
}
|
||||
} catch (error) {
|
||||
handleError(error as AxiosError)
|
||||
console.error(error as AxiosError)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user