Answer the question
In order to leave comments, you need to log in
How to get exceptions from django-rest in vue.js?
I am using django-rest-passwordreset to recover a forgotten password.
In Vue.js I have a method to set a new password. It works, but you need to get exceptions if the password is too short or too simple, etc..
methods: {
set_password() {
axios.post('/app/reset-password/confirm/', {'password': this.password, 'token': this.token})
.then(response => {
console.log(response)
})
.catch(error => {
console.log(error)
})
}
},
http://localhost:8000/app/reset-password/confirm/
which should throw exceptions on the server (for example, a short password) via RestMan, I get{
"password": [
"This password is too short. It must contain at least 8 characters.",
"This password is too common."
]
}
POST http://localhost:8000/app/reset-password/confirm/ 400 (Bad Request)
Error: Request failed with status code 400
at createError (build.js:15685)
at settle (build.js:27186)
at XMLHttpRequest.handleLoad (build.js:15559)
{data: {…}, status: 200, statusText: "OK", headers: {…}, config: {…}, …}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question