Fixed broken error handling on user login and settings
This commit is contained in:
parent
0ed3f68305
commit
55b38a3f6e
|
@ -73,9 +73,9 @@ export default {
|
||||||
// to properly make use of http in the auth service
|
// to properly make use of http in the auth service
|
||||||
this.$store.dispatch('auth/login', {
|
this.$store.dispatch('auth/login', {
|
||||||
credentials,
|
credentials,
|
||||||
next: this.next,
|
next: '/library',
|
||||||
onError: response => {
|
onError: error => {
|
||||||
if (response.status === 400) {
|
if (error.response.status === 400) {
|
||||||
self.error = 'invalid_credentials'
|
self.error = 'invalid_credentials'
|
||||||
} else {
|
} else {
|
||||||
self.error = 'unknown_error'
|
self.error = 'unknown_error'
|
||||||
|
|
|
@ -37,7 +37,6 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import config from '@/config'
|
|
||||||
import logger from '@/logging'
|
import logger from '@/logging'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -61,12 +60,16 @@ export default {
|
||||||
new_password1: this.new_password,
|
new_password1: this.new_password,
|
||||||
new_password2: 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 => {
|
return axios.post(url, credentials).then(response => {
|
||||||
logger.default.info('Password successfully changed')
|
logger.default.info('Password successfully changed')
|
||||||
self.$router.push('/profile/me')
|
self.$router.push({
|
||||||
}, response => {
|
name: 'profile',
|
||||||
if (response.status === 400) {
|
params: {
|
||||||
|
username: self.$store.state.auth.username
|
||||||
|
}})
|
||||||
|
}, error => {
|
||||||
|
if (error.response.status === 400) {
|
||||||
self.error = 'invalid_credentials'
|
self.error = 'invalid_credentials'
|
||||||
} else {
|
} else {
|
||||||
self.error = 'unknown_error'
|
self.error = 'unknown_error'
|
||||||
|
|
Loading…
Reference in New Issue