Fix using the error data prop in components (#53)

Fix error msg data props everywhere

Fix error msg data props

Co-authored-by: kolaente <k@knt.li>
Reviewed-on: vikunja/frontend#53
This commit is contained in:
konrad 2020-01-31 15:33:14 +00:00
parent 5f0b5a0945
commit 604488c68c
5 changed files with 22 additions and 22 deletions

View File

@ -40,9 +40,9 @@ export default {
// Hide the loader // Hide the loader
context.loading = false context.loading = false
if (e.response) { if (e.response) {
context.error = e.response.data.message context.errorMsg = e.response.data.message
if (e.response.status === 401) { 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 // Hide the loader
context.loading = false context.loading = false
if (e.response) { if (e.response) {
context.error = e.response.data.message context.errorMsg = e.response.data.message
if (e.response.status === 401) { if (e.response.status === 401) {
context.error = 'Wrong username or password.' context.errorMsg = 'Wrong username or password.'
} }
} }
}) })

View File

@ -26,8 +26,8 @@
<router-link :to="{ name: 'getPasswordReset' }" class="reset-password-link">Reset your password</router-link> <router-link :to="{ name: 'getPasswordReset' }" class="reset-password-link">Reset your password</router-link>
</div> </div>
</div> </div>
<div class="notification is-danger" v-if="error"> <div class="notification is-danger" v-if="errorMsg">
{{ error }} {{ errorMsg }}
</div> </div>
</form> </form>
</div> </div>
@ -47,7 +47,7 @@
username: '', username: '',
password: '' password: ''
}, },
error: '', errorMsg: '',
confirmedEmailSuccess: false, confirmedEmailSuccess: false,
loading: false loading: false
} }
@ -66,7 +66,7 @@
}) })
.catch(e => { .catch(e => {
cancel() cancel()
this.error = e.response.data.message this.errorMsg = e.response.data.message
}) })
} }
@ -78,7 +78,7 @@
methods: { methods: {
submit() { submit() {
this.loading = true this.loading = true
this.error = '' this.errorMsg = ''
let credentials = { let credentials = {
username: this.credentials.username, username: this.credentials.username,
password: this.credentials.password password: this.credentials.password

View File

@ -25,7 +25,7 @@
Loading... Loading...
</div> </div>
<div class="notification is-danger" v-if="error"> <div class="notification is-danger" v-if="error">
{{ error }} {{ errorMsg }}
</div> </div>
</form> </form>
<div v-if="successMessage" class="has-text-centered"> <div v-if="successMessage" class="has-text-centered">
@ -50,7 +50,7 @@
password: '', password: '',
password2: '', password2: '',
}, },
error: '', errorMsg: '',
successMessage: '' successMessage: ''
} }
}, },
@ -59,10 +59,10 @@
}, },
methods: { methods: {
submit() { submit() {
this.error = '' this.errorMsg = ''
if (this.credentials.password2 !== this.credentials.password) { if (this.credentials.password2 !== this.credentials.password) {
this.error = 'Passwords don\'t match' this.errorMsg = 'Passwords don\'t match'
return return
} }
@ -73,7 +73,7 @@
localStorage.removeItem('passwordResetToken') localStorage.removeItem('passwordResetToken')
}) })
.catch(e => { .catch(e => {
this.error = e.response.data.message this.errorMsg = e.response.data.message
}) })
} }
} }

View File

@ -38,7 +38,7 @@
Loading... Loading...
</div> </div>
<div class="notification is-danger" v-if="error"> <div class="notification is-danger" v-if="error">
{{ error }} {{ errorMsg }}
</div> </div>
</form> </form>
</div> </div>
@ -58,7 +58,7 @@
password: '', password: '',
password2: '', password2: '',
}, },
error: '', errorMsg: '',
loading: false loading: false
} }
}, },
@ -72,11 +72,11 @@
submit() { submit() {
this.loading = true this.loading = true
this.error = '' this.errorMsg = ''
if (this.credentials.password2 !== this.credentials.password) { if (this.credentials.password2 !== this.credentials.password) {
this.loading = false this.loading = false
this.error = 'Passwords don\'t match' this.errorMsg = 'Passwords don\'t match'
return return
} }

View File

@ -17,7 +17,7 @@
</div> </div>
</div> </div>
<div class="notification is-danger" v-if="error"> <div class="notification is-danger" v-if="error">
{{ error }} {{ errorMsg }}
</div> </div>
</form> </form>
<div v-if="isSuccess" class="has-text-centered"> <div v-if="isSuccess" class="has-text-centered">
@ -39,7 +39,7 @@
return { return {
passwordResetService: PasswordResetService, passwordResetService: PasswordResetService,
passwordReset: PasswordResetModel, passwordReset: PasswordResetModel,
error: '', errorMsg: '',
isSuccess: false isSuccess: false
} }
}, },
@ -49,13 +49,13 @@
}, },
methods: { methods: {
submit() { submit() {
this.error = '' this.errorMsg = ''
this.passwordResetService.requestResetPassword(this.passwordReset) this.passwordResetService.requestResetPassword(this.passwordReset)
.then(() => { .then(() => {
this.isSuccess = true this.isSuccess = true
}) })
.catch(e => { .catch(e => {
this.error = e.response.data.message this.errorMsg = e.response.data.message
}) })
}, },
} }