Add loading indicator for notifications, make timelines indicate bottoming out when no more statuses

This commit is contained in:
shpuld 2019-01-29 21:04:52 +02:00
parent 3cfbf0141f
commit 62e9525724
9 changed files with 53 additions and 10 deletions

View file

@ -13,6 +13,11 @@ const Notifications = {
notificationsFetcher.startFetching({ store, credentials })
},
data () {
return {
bottomedOut: false
}
},
computed: {
notifications () {
return notificationsFromStore(this.$store)
@ -28,6 +33,9 @@ const Notifications = {
},
unseenCount () {
return this.unseenNotifications.length
},
loading () {
return this.$store.state.statuses.notifications.loading
}
},
components: {
@ -49,10 +57,16 @@ const Notifications = {
fetchOlderNotifications () {
const store = this.$store
const credentials = store.state.users.currentUser.credentials
store.commit('setNotificationsLoading', { value: true })
notificationsFetcher.fetchAndUpdate({
store,
credentials,
older: true
}).then(notifs => {
store.commit('setNotificationsLoading', { value: false })
if (notifs.length === 0) {
this.bottomedOut = true
}
})
}
}