diff options
| author | wakarimasen <wakarimasen@airmail.cc> | 2017-03-08 18:28:41 +0100 |
|---|---|---|
| committer | wakarimasen <wakarimasen@airmail.cc> | 2017-03-08 18:28:41 +0100 |
| commit | a6b6fe95c0fe2aa60ebbfca87fde47e629035c49 (patch) | |
| tree | f1ce15596cef36aa03a0e6f41ee3c2e7f2633acd /src/components | |
| parent | ccbfc64bfcaf5efd598af6987e304291e23def1c (diff) | |
Show visual feedback on login error, redirect on success
Diffstat (limited to 'src/components')
| -rw-r--r-- | src/components/login_form/login_form.js | 8 | ||||
| -rw-r--r-- | src/components/login_form/login_form.vue | 9 |
2 files changed, 15 insertions, 2 deletions
diff --git a/src/components/login_form/login_form.js b/src/components/login_form/login_form.js index 827c704c..2ad5b0b5 100644 --- a/src/components/login_form/login_form.js +++ b/src/components/login_form/login_form.js @@ -1,13 +1,17 @@ const LoginForm = { data: () => ({ - user: {} + user: {}, + authError: false }), computed: { loggingIn () { return this.$store.state.users.loggingIn } }, methods: { submit () { - this.$store.dispatch('loginUser', this.user) + this.$store.dispatch('loginUser', this.user).then( + () => { this.$router.push('/main/friends')}, + () => { this.authError = true } + ) } } } diff --git a/src/components/login_form/login_form.vue b/src/components/login_form/login_form.vue index c0273bae..279469ee 100644 --- a/src/components/login_form/login_form.vue +++ b/src/components/login_form/login_form.vue @@ -17,6 +17,9 @@ <div class='form-group'> <button :disabled="loggingIn" type='submit' class='btn btn-default base05 base01-background'>Submit</button> </div> + <div v-if="authError" class='form-group'> + <button disabled='true' class='btn btn-default base05 error'>Error logging in, try again</button> + </div> </form> </div> </div> @@ -39,6 +42,12 @@ margin-top: 1.0em; min-height: 28px; } + + .error { + margin-top: 0em; + margin-bottom: 0em; + background-color: rgba(255, 48, 16, 0.65); + } } </style> |
