aboutsummaryrefslogtreecommitdiff
path: root/src/services/timeline_fetcher
diff options
context:
space:
mode:
authorwakarimasen <wakarimasen@airmail.cc>2017-03-07 17:27:12 +0100
committerwakarimasen <wakarimasen@airmail.cc>2017-03-07 17:27:12 +0100
commit086dd832d3d2c8103e7d6f99d72d27bea97ce7b0 (patch)
treeac3158e5191a83f128c2c63f7e89eae6351f7029 /src/services/timeline_fetcher
parentaa0d207c945d61678801910719b0b013df75a78a (diff)
Visual feedback on failure to fetch new statuses
Diffstat (limited to 'src/services/timeline_fetcher')
-rw-r--r--src/services/timeline_fetcher/timeline_fetcher.service.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/services/timeline_fetcher/timeline_fetcher.service.js b/src/services/timeline_fetcher/timeline_fetcher.service.js
index 37bbcd82..40f568c3 100644
--- a/src/services/timeline_fetcher/timeline_fetcher.service.js
+++ b/src/services/timeline_fetcher/timeline_fetcher.service.js
@@ -12,6 +12,15 @@ const update = ({store, statuses, timeline, showImmediately}) => {
})
}
+const setError = ({store, timeline, value}) => {
+ const ccTimeline = camelCase(timeline)
+
+ store.dispatch('setError', {
+ timeline: ccTimeline,
+ value
+ })
+}
+
const fetchAndUpdate = ({store, credentials, timeline = 'friends', older = false, showImmediately = false}) => {
const args = { timeline, credentials }
const rootState = store.rootState || store.state
@@ -25,6 +34,8 @@ const fetchAndUpdate = ({store, credentials, timeline = 'friends', older = false
return apiService.fetchTimeline(args)
.then((statuses) => update({store, statuses, timeline, showImmediately}))
+ .then(() => setError({store, timeline, value: false}))
+ .catch(() => setError({store, timeline, value: true}))
}
const startFetching = ({ timeline = 'friends', credentials, store }) => {