aboutsummaryrefslogtreecommitdiff
path: root/src/services/timeline_fetcher
diff options
context:
space:
mode:
authorEugenij <eugenijm@protonmail.com>2020-07-03 19:45:49 +0000
committerShpuld Shpludson <shp@cock.li>2020-07-03 19:45:49 +0000
commitde291e2e33f1d9e04b27ed30ba3b012d73178e63 (patch)
treec289fdff07b399d9dbd19e024dde2b6322ead655 /src/services/timeline_fetcher
parent7bd89b579f9fa20a046b67dbf5cd14967b07981c (diff)
Add bookmarks
Co-authored-by: jared <jaredrmain@gmail.com>
Diffstat (limited to 'src/services/timeline_fetcher')
-rw-r--r--src/services/timeline_fetcher/timeline_fetcher.service.js17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/services/timeline_fetcher/timeline_fetcher.service.js b/src/services/timeline_fetcher/timeline_fetcher.service.js
index 30fb26bd..214294eb 100644
--- a/src/services/timeline_fetcher/timeline_fetcher.service.js
+++ b/src/services/timeline_fetcher/timeline_fetcher.service.js
@@ -2,7 +2,7 @@ import { camelCase } from 'lodash'
import apiService from '../api/api.service.js'
-const update = ({ store, statuses, timeline, showImmediately, userId }) => {
+const update = ({ store, statuses, timeline, showImmediately, userId, pagination }) => {
const ccTimeline = camelCase(timeline)
store.dispatch('setError', { value: false })
@@ -12,7 +12,8 @@ const update = ({ store, statuses, timeline, showImmediately, userId }) => {
timeline: ccTimeline,
userId,
statuses,
- showImmediately
+ showImmediately,
+ pagination
})
}
@@ -47,16 +48,18 @@ const fetchAndUpdate = ({
const numStatusesBeforeFetch = timelineData.statuses.length
return apiService.fetchTimeline(args)
- .then((statuses) => {
- if (statuses.error) {
- store.dispatch('setErrorData', { value: statuses })
+ .then(response => {
+ if (response.error) {
+ store.dispatch('setErrorData', { value: response })
return
}
+
+ const { data: statuses, pagination } = response
if (!older && statuses.length >= 20 && !timelineData.loading && numStatusesBeforeFetch > 0) {
store.dispatch('queueFlush', { timeline: timeline, id: timelineData.maxId })
}
- update({ store, statuses, timeline, showImmediately, userId })
- return statuses
+ update({ store, statuses, timeline, showImmediately, userId, pagination })
+ return { statuses, pagination }
}, () => store.dispatch('setError', { value: true }))
}