From 086dd832d3d2c8103e7d6f99d72d27bea97ce7b0 Mon Sep 17 00:00:00 2001 From: wakarimasen Date: Tue, 7 Mar 2017 17:27:12 +0100 Subject: Visual feedback on failure to fetch new statuses --- src/services/timeline_fetcher/timeline_fetcher.service.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/services/timeline_fetcher/timeline_fetcher.service.js') 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 }) => { -- cgit v1.2.3-70-g09d2