From e1103f04a44133fa5775b0be1fd5e2acce79daef Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Sun, 6 Nov 2016 17:44:05 +0100 Subject: Add fetching of older statuses. --- src/components/timeline/timeline.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/components/timeline/timeline.js') diff --git a/src/components/timeline/timeline.js b/src/components/timeline/timeline.js index 433bca11..113455f4 100644 --- a/src/components/timeline/timeline.js +++ b/src/components/timeline/timeline.js @@ -1,4 +1,5 @@ import Status from '../status/status.vue' +import timelineFetcher from '../../services/timeline_fetcher/timeline_fetcher.service.js' const Timeline = { props: [ @@ -11,6 +12,18 @@ const Timeline = { methods: { showNewStatuses () { this.$store.commit('showNewStatuses', { timeline: this.timelineName }) + }, + fetchOlderStatuses () { + const store = this.$store + const credentials = store.state.users.currentUser.credentials + store.commit('setLoading', { timeline: this.timelineName, value: true }); + timelineFetcher.fetchAndUpdate({ + store, + credentials, + timeline: this.timelineName, + older: true, + showImmediately: true + }).then(() => store.commit('setLoading', { timeline: this.timelineName, value: false })) } } } -- cgit v1.2.3-70-g09d2 From c9e235f8898c4f1c4c1c2d5111ad34b1dd4ffa10 Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Sun, 6 Nov 2016 20:11:00 +0100 Subject: Load timeline once on creation. --- src/components/timeline/timeline.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/components/timeline/timeline.js') diff --git a/src/components/timeline/timeline.js b/src/components/timeline/timeline.js index 113455f4..e0c75d76 100644 --- a/src/components/timeline/timeline.js +++ b/src/components/timeline/timeline.js @@ -9,6 +9,17 @@ const Timeline = { components: { Status }, + created () { + const store = this.$store + const credentials = store.state.users.currentUser.credentials + + timelineFetcher.fetchAndUpdate({ + store, + credentials, + timeline: this.timelineName, + showImmediately: true + }) + }, methods: { showNewStatuses () { this.$store.commit('showNewStatuses', { timeline: this.timelineName }) -- cgit v1.2.3-70-g09d2