mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-28 04:01:10 -04:00
fix isLoading issue
This commit is contained in:
@ -313,59 +313,56 @@ export default {
|
|||||||
name: this.formData.name,
|
name: this.formData.name,
|
||||||
email: this.formData.email,
|
email: this.formData.email,
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
if (
|
if (
|
||||||
this.formData.password != null &&
|
this.formData.password != null &&
|
||||||
this.formData.password !== undefined &&
|
this.formData.password !== undefined &&
|
||||||
this.formData.password !== ''
|
this.formData.password !== ''
|
||||||
) {
|
) {
|
||||||
data = { ...data, password: this.formData.password }
|
data = { ...data, password: this.formData.password }
|
||||||
}
|
|
||||||
|
|
||||||
let response = await this.updateCurrentUser(data)
|
|
||||||
|
|
||||||
let languageData = {
|
|
||||||
settings: {
|
|
||||||
language: this.language.code,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
let languageRes = await this.updateUserSettings(languageData)
|
|
||||||
|
|
||||||
// if(languageRes) {
|
|
||||||
// window.i18n.locale = this.language.code
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (response.data.success) {
|
|
||||||
this.isLoading = false
|
|
||||||
|
|
||||||
if (this.fileObject && this.previewAvatar) {
|
|
||||||
let avatarData = new FormData()
|
|
||||||
|
|
||||||
avatarData.append(
|
|
||||||
'admin_avatar',
|
|
||||||
JSON.stringify({
|
|
||||||
name: this.fileObject.name,
|
|
||||||
data: this.previewAvatar,
|
|
||||||
})
|
|
||||||
)
|
|
||||||
this.uploadAvatar(avatarData)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
window.toastr['success'](
|
let response = await this.updateCurrentUser(data)
|
||||||
this.$t('settings.account_settings.updated_message')
|
|
||||||
)
|
|
||||||
|
|
||||||
this.formData.password = ''
|
let languageData = {
|
||||||
this.formData.confirm_password = ''
|
settings: {
|
||||||
|
language: this.language.code,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
let languageRes = await this.updateUserSettings(languageData)
|
||||||
|
|
||||||
|
// if(languageRes) {
|
||||||
|
// window.i18n.locale = this.language.code
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (response.data.success) {
|
||||||
|
this.isLoading = false
|
||||||
|
|
||||||
|
if (this.fileObject && this.previewAvatar) {
|
||||||
|
let avatarData = new FormData()
|
||||||
|
|
||||||
|
avatarData.append(
|
||||||
|
'admin_avatar',
|
||||||
|
JSON.stringify({
|
||||||
|
name: this.fileObject.name,
|
||||||
|
data: this.previewAvatar,
|
||||||
|
})
|
||||||
|
)
|
||||||
|
this.uploadAvatar(avatarData)
|
||||||
|
}
|
||||||
|
|
||||||
|
window.toastr['success'](
|
||||||
|
this.$t('settings.account_settings.updated_message')
|
||||||
|
)
|
||||||
|
|
||||||
|
this.formData.password = ''
|
||||||
|
this.formData.confirm_password = ''
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
this.isLoading = false
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
window.toastr['error'](response.data.error)
|
|
||||||
|
|
||||||
this.isLoading = false
|
|
||||||
|
|
||||||
return true
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user