From b7d7c216177407e451bbab4a6178016dcd7b805d Mon Sep 17 00:00:00 2001 From: jasper Date: Tue, 9 Apr 2019 08:57:41 -0700 Subject: [PATCH] Add await to login befor redirect to friends timeline --- src/components/login_form/login_form.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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'}) }) })