Fixed broken error handling on user login and settings

This commit is contained in:
Eliot Berriot 2018-02-24 14:28:48 +01:00
parent 0ed3f68305
commit 55b38a3f6e
No known key found for this signature in database
GPG Key ID: DD6965E2476E5C27
2 changed files with 11 additions and 8 deletions

View File

@ -73,9 +73,9 @@ export default {
// to properly make use of http in the auth service
this.$store.dispatch('auth/login', {
credentials,
next: this.next,
onError: response => {
if (response.status === 400) {
next: '/library',
onError: error => {
if (error.response.status === 400) {
self.error = 'invalid_credentials'
} else {
self.error = 'unknown_error'

View File

@ -37,7 +37,6 @@
<script>
import axios from 'axios'
import config from '@/config'
import logger from '@/logging'
export default {
@ -61,12 +60,16 @@ export default {
new_password1: this.new_password,
new_password2: this.new_password
}
let url = config.BACKEND_URL + 'api/auth/registration/change-password/'
let url = 'auth/registration/change-password/'
return axios.post(url, credentials).then(response => {
logger.default.info('Password successfully changed')
self.$router.push('/profile/me')
}, response => {
if (response.status === 400) {
self.$router.push({
name: 'profile',
params: {
username: self.$store.state.auth.username
}})
}, error => {
if (error.response.status === 400) {
self.error = 'invalid_credentials'
} else {
self.error = 'unknown_error'