From 86a20f2982fbd7f766b321fb780b76ba96d14d27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= Date: Wed, 8 May 2019 21:34:40 +0200 Subject: [PATCH] FormDialog error message (snackbar) --- frontend/src/components/forms/FormDialog.vue | 25 +++++++++++++++++++- frontend/src/components/forms/Login.vue | 4 +++- frontend/src/components/forms/Register.vue | 6 ++++- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/forms/FormDialog.vue b/frontend/src/components/forms/FormDialog.vue index 490aa9e..34c940e 100644 --- a/frontend/src/components/forms/FormDialog.vue +++ b/frontend/src/components/forms/FormDialog.vue @@ -5,6 +5,13 @@ + + {{ errorText }} + + close + + + ({ dialog: false, - valid: true + valid: true, + hasError: false, + errorText: '' }), props: { @@ -48,6 +57,20 @@ export default { if (this.$refs.form.validate()) { this.$emit('confirm') } + }, + + showError(text) { + let actually = () => { + this.hasError = true + this.errorText = text + } + + if (this.hasError) { + this.hasError = false + window.setTimeout(actually, 100) + } else { + actually() + } } }, diff --git a/frontend/src/components/forms/Login.vue b/frontend/src/components/forms/Login.vue index 3ced5fc..c1fd89d 100644 --- a/frontend/src/components/forms/Login.vue +++ b/frontend/src/components/forms/Login.vue @@ -1,5 +1,5 @@