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: https://kolaente.dev/vikunja/frontend/pulls/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
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.'
}
}
})

View file

@ -26,8 +26,8 @@
<router-link :to="{ name: 'getPasswordReset' }" class="reset-password-link">Reset your password</router-link>
</div>
</div>
<div class="notification is-danger" v-if="error">
{{ error }}
<div class="notification is-danger" v-if="errorMsg">
{{ errorMsg }}
</div>
</form>
</div>
@ -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

View file

@ -25,7 +25,7 @@
Loading...
</div>
<div class="notification is-danger" v-if="error">
{{ error }}
{{ errorMsg }}
</div>
</form>
<div v-if="successMessage" class="has-text-centered">
@ -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
})
}
}

View file

@ -38,7 +38,7 @@
Loading...
</div>
<div class="notification is-danger" v-if="error">
{{ error }}
{{ errorMsg }}
</div>
</form>
</div>
@ -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
}

View file

@ -17,7 +17,7 @@
</div>
</div>
<div class="notification is-danger" v-if="error">
{{ error }}
{{ errorMsg }}
</div>
</form>
<div v-if="isSuccess" class="has-text-centered">
@ -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
})
},
}