diff --git a/src/components/login_form/login_form.js b/src/components/login_form/login_form.js index fb6dc651..e0fbb329 100644 --- a/src/components/login_form/login_form.js +++ b/src/components/login_form/login_form.js @@ -31,14 +31,18 @@ const LoginForm = { username: this.user.username, password: this.user.password } - ).then((result) => { + ).then(async (result) => { if (result.error) { this.authError = result.error this.user.password = '' return } this.$store.commit('setToken', result.access_token) - this.$store.dispatch('loginUser', result.access_token) + try { + await this.$store.dispatch('loginUser', result.access_token) + } catch (e) { + console.log(e) + } this.$router.push({name: 'friends'}) }) })