aboutsummaryrefslogtreecommitdiff
path: root/src/components
diff options
context:
space:
mode:
authorRoger Braun <roger@rogerbraun.net>2016-11-06 17:44:05 +0100
committerRoger Braun <roger@rogerbraun.net>2016-11-06 17:44:05 +0100
commite1103f04a44133fa5775b0be1fd5e2acce79daef (patch)
tree7e5b7b3eeb47356d4a704a8fa5a0e8543eeae2ec /src/components
parent1a94217222de1b5f61a1b88bf633d752d45ccc1f (diff)
Add fetching of older statuses.
Diffstat (limited to 'src/components')
-rw-r--r--src/components/timeline/timeline.js13
-rw-r--r--src/components/timeline/timeline.vue7
2 files changed, 20 insertions, 0 deletions
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 }))
}
}
}
diff --git a/src/components/timeline/timeline.vue b/src/components/timeline/timeline.vue
index 1e779638..2f1b8c28 100644
--- a/src/components/timeline/timeline.vue
+++ b/src/components/timeline/timeline.vue
@@ -8,6 +8,13 @@
</div>
</a>
<status v-for="status in timeline.visibleStatuses" :key="status.id" v-bind:statusoid="status"></status>
+ <a href="#" v-on:click.prevent='fetchOlderStatuses()' v-if="!timeline.loading">
+ <div class="new-status-notification">
+ <p class="text-center" >
+ Load older statuses.
+ </p>
+ </div>
+ </a>
</div>
</template>
<script src="./timeline.js"></script>