diff options
| author | wakarimasen <wakarimasen@airmail.cc> | 2017-03-09 13:38:32 +0100 |
|---|---|---|
| committer | wakarimasen <wakarimasen@airmail.cc> | 2017-03-09 13:38:32 +0100 |
| commit | e064d2da4de67ad42268f8eea0efd20646b3cb16 (patch) | |
| tree | 7d99cda63bbfa0ee88867ebc431c2ea91f14e273 /src/services/timeline_fetcher/timeline_fetcher.service.js | |
| parent | 64d71b75cfed41d82a99e3e478fc75d5f81f84bd (diff) | |
Use one error variable for all timelines
Diffstat (limited to 'src/services/timeline_fetcher/timeline_fetcher.service.js')
| -rw-r--r-- | src/services/timeline_fetcher/timeline_fetcher.service.js | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/src/services/timeline_fetcher/timeline_fetcher.service.js b/src/services/timeline_fetcher/timeline_fetcher.service.js index e684a170..24aef069 100644 --- a/src/services/timeline_fetcher/timeline_fetcher.service.js +++ b/src/services/timeline_fetcher/timeline_fetcher.service.js @@ -5,7 +5,7 @@ import apiService from '../api/api.service.js' const update = ({store, statuses, timeline, showImmediately}) => { const ccTimeline = camelCase(timeline) - setError({store, timeline, value: false}) + store.dispatch('setError', { value: false }) store.dispatch('addNewStatuses', { timeline: ccTimeline, @@ -14,15 +14,6 @@ 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 @@ -36,7 +27,7 @@ const fetchAndUpdate = ({store, credentials, timeline = 'friends', older = false return apiService.fetchTimeline(args) .then((statuses) => update({store, statuses, timeline, showImmediately}), - () => setError({store, timeline, value: true})) + () => store.dispatch('setError', { value: true })) } const startFetching = ({ timeline = 'friends', credentials, store }) => { |
