From 604488c68cbed1db1a11582299d69b6cb463b15e Mon Sep 17 00:00:00 2001 From: konrad Date: Fri, 31 Jan 2020 15:33:14 +0000 Subject: [PATCH] Fix using the error data prop in components (#53) Fix error msg data props everywhere Fix error msg data props Co-authored-by: kolaente Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/53 --- src/auth/index.js | 8 ++++---- src/components/user/Login.vue | 10 +++++----- src/components/user/PasswordReset.vue | 10 +++++----- src/components/user/Register.vue | 8 ++++---- src/components/user/RequestPasswordReset.vue | 8 ++++---- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/auth/index.js b/src/auth/index.js index 1f6d9904..bee3bbb6 100644 --- a/src/auth/index.js +++ b/src/auth/index.js @@ -40,9 +40,9 @@ export default { // Hide the loader context.loading = false if (e.response) { - context.error = e.response.data.message + context.errorMsg = e.response.data.message if (e.response.status === 401) { - context.error = 'Wrong username or password.' + context.errorMsg = 'Wrong username or password.' } } }) @@ -61,9 +61,9 @@ export default { // Hide the loader context.loading = false if (e.response) { - context.error = e.response.data.message + context.errorMsg = e.response.data.message if (e.response.status === 401) { - context.error = 'Wrong username or password.' + context.errorMsg = 'Wrong username or password.' } } }) diff --git a/src/components/user/Login.vue b/src/components/user/Login.vue index fcdc0226..1c403198 100644 --- a/src/components/user/Login.vue +++ b/src/components/user/Login.vue @@ -26,8 +26,8 @@ Reset your password -
- {{ error }} +
+ {{ errorMsg }}
@@ -47,7 +47,7 @@ username: '', password: '' }, - error: '', + errorMsg: '', confirmedEmailSuccess: false, loading: false } @@ -66,7 +66,7 @@ }) .catch(e => { cancel() - this.error = e.response.data.message + this.errorMsg = e.response.data.message }) } @@ -78,7 +78,7 @@ methods: { submit() { this.loading = true - this.error = '' + this.errorMsg = '' let credentials = { username: this.credentials.username, password: this.credentials.password diff --git a/src/components/user/PasswordReset.vue b/src/components/user/PasswordReset.vue index 933b57f3..c565cc3f 100644 --- a/src/components/user/PasswordReset.vue +++ b/src/components/user/PasswordReset.vue @@ -25,7 +25,7 @@ Loading...
- {{ error }} + {{ errorMsg }}
@@ -50,7 +50,7 @@ password: '', password2: '', }, - error: '', + errorMsg: '', successMessage: '' } }, @@ -59,10 +59,10 @@ }, methods: { submit() { - this.error = '' + this.errorMsg = '' if (this.credentials.password2 !== this.credentials.password) { - this.error = 'Passwords don\'t match' + this.errorMsg = 'Passwords don\'t match' return } @@ -73,7 +73,7 @@ localStorage.removeItem('passwordResetToken') }) .catch(e => { - this.error = e.response.data.message + this.errorMsg = e.response.data.message }) } } diff --git a/src/components/user/Register.vue b/src/components/user/Register.vue index c2039305..abb37daa 100644 --- a/src/components/user/Register.vue +++ b/src/components/user/Register.vue @@ -38,7 +38,7 @@ Loading...
- {{ error }} + {{ errorMsg }}
@@ -58,7 +58,7 @@ password: '', password2: '', }, - error: '', + errorMsg: '', loading: false } }, @@ -72,11 +72,11 @@ submit() { this.loading = true - this.error = '' + this.errorMsg = '' if (this.credentials.password2 !== this.credentials.password) { this.loading = false - this.error = 'Passwords don\'t match' + this.errorMsg = 'Passwords don\'t match' return } diff --git a/src/components/user/RequestPasswordReset.vue b/src/components/user/RequestPasswordReset.vue index 4ec4f985..73d8c69e 100644 --- a/src/components/user/RequestPasswordReset.vue +++ b/src/components/user/RequestPasswordReset.vue @@ -17,7 +17,7 @@
- {{ error }} + {{ errorMsg }}
@@ -39,7 +39,7 @@ return { passwordResetService: PasswordResetService, passwordReset: PasswordResetModel, - error: '', + errorMsg: '', isSuccess: false } }, @@ -49,13 +49,13 @@ }, methods: { submit() { - this.error = '' + this.errorMsg = '' this.passwordResetService.requestResetPassword(this.passwordReset) .then(() => { this.isSuccess = true }) .catch(e => { - this.error = e.response.data.message + this.errorMsg = e.response.data.message }) }, }