From 1570e779b1a3497f29e0681f1390322e8e65030b Mon Sep 17 00:00:00 2001 From: jasper Date: Tue, 9 Apr 2019 08:38:13 -0700 Subject: [PATCH 1/3] Prevent repeated fetching --- src/components/timeline/timeline.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/timeline/timeline.js b/src/components/timeline/timeline.js index 1da7d5cc52..19d9a9ac2d 100644 --- a/src/components/timeline/timeline.js +++ b/src/components/timeline/timeline.js @@ -52,7 +52,7 @@ const Timeline = { window.addEventListener('scroll', this.scrollLoad) - if (this.timelineName === 'friends' && !credentials) { return false } + if (store.state.api.fetchers[this.timelineName]) { return false } timelineFetcher.fetchAndUpdate({ store, From b7d7c216177407e451bbab4a6178016dcd7b805d Mon Sep 17 00:00:00 2001 From: jasper Date: Tue, 9 Apr 2019 08:57:41 -0700 Subject: [PATCH 2/3] 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 fb6dc651ec..e0fbb32987 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'}) }) }) From 011f04c196318e25cfff10f3fa41321070511919 Mon Sep 17 00:00:00 2001 From: jasper Date: Tue, 9 Apr 2019 09:19:48 -0700 Subject: [PATCH 3/3] fix small bug --- src/components/login_form/login_form.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/login_form/login_form.js b/src/components/login_form/login_form.js index e0fbb32987..dc917e4774 100644 --- a/src/components/login_form/login_form.js +++ b/src/components/login_form/login_form.js @@ -40,10 +40,10 @@ const LoginForm = { this.$store.commit('setToken', result.access_token) try { await this.$store.dispatch('loginUser', result.access_token) + this.$router.push({name: 'friends'}) } catch (e) { console.log(e) } - this.$router.push({name: 'friends'}) }) }) },