aboutsummaryrefslogtreecommitdiff
path: root/src/components
diff options
context:
space:
mode:
Diffstat (limited to 'src/components')
-rw-r--r--src/components/login_form/login_form.js12
-rw-r--r--src/components/login_form/login_form.vue11
2 files changed, 21 insertions, 2 deletions
diff --git a/src/components/login_form/login_form.js b/src/components/login_form/login_form.js
index 827c704c..bc801397 100644
--- a/src/components/login_form/login_form.js
+++ b/src/components/login_form/login_form.js
@@ -1,13 +1,21 @@
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')},
+ (error) => {
+ this.authError = error
+ this.user.username = ''
+ this.user.password = ''
+ }
+ )
}
}
}
diff --git a/src/components/login_form/login_form.vue b/src/components/login_form/login_form.vue
index c0273bae..b2fa5341 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'>
+ <div class='error base05'>{{authError}}</div>
+ </div>
</form>
</div>
</div>
@@ -39,6 +42,14 @@
margin-top: 1.0em;
min-height: 28px;
}
+
+ .error {
+ border-radius: 5px;
+ text-align: center;
+ background-color: rgba(255, 48, 16, 0.65);
+ min-height: 28px;
+ line-height: 28px;
+ }
}
</style>