Merge branch 'feature/timeline-fetch-error' into 'develop'

Use one error variable for all timelines

See merge request !57
This commit is contained in:
Shpuld Shpuldson 2017-03-09 08:06:59 -05:00
commit 7aa1f02e38
4 changed files with 17 additions and 26 deletions

View file

@ -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 }) => {