Move rejection handler

This commit is contained in:
wakarimasen 2017-03-07 21:38:55 +01:00
parent 086dd832d3
commit 7d52258378

View File

@ -5,6 +5,8 @@ import apiService from '../api/api.service.js'
const update = ({store, statuses, timeline, showImmediately}) => { const update = ({store, statuses, timeline, showImmediately}) => {
const ccTimeline = camelCase(timeline) const ccTimeline = camelCase(timeline)
setError({store, timeline, value: false})
store.dispatch('addNewStatuses', { store.dispatch('addNewStatuses', {
timeline: ccTimeline, timeline: ccTimeline,
statuses, statuses,
@ -33,9 +35,8 @@ const fetchAndUpdate = ({store, credentials, timeline = 'friends', older = false
} }
return apiService.fetchTimeline(args) return apiService.fetchTimeline(args)
.then((statuses) => update({store, statuses, timeline, showImmediately})) .then((statuses) => update({store, statuses, timeline, showImmediately}),
.then(() => setError({store, timeline, value: false})) () => setError({store, timeline, value: true}))
.catch(() => setError({store, timeline, value: true}))
} }
const startFetching = ({ timeline = 'friends', credentials, store }) => { const startFetching = ({ timeline = 'friends', credentials, store }) => {