diff options
| author | jasper <jasper92341@hotmail.com> | 2019-04-09 08:57:41 -0700 |
|---|---|---|
| committer | jasper <jasper92341@hotmail.com> | 2019-04-09 08:57:41 -0700 |
| commit | b7d7c216177407e451bbab4a6178016dcd7b805d (patch) | |
| tree | 457a5252ed8c9a78943ad9a4bcf304c256bf57fa /src | |
| parent | 1570e779b1a3497f29e0681f1390322e8e65030b (diff) | |
Add await to login befor redirect to friends timeline
Diffstat (limited to 'src')
| -rw-r--r-- | src/components/login_form/login_form.js | 8 |
1 files 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'}) }) }) |
