Change naming, make more general

This commit is contained in:
Wyatt Benno 2019-12-09 09:02:34 +09:00
parent 01855f315c
commit e86af0c965
5 changed files with 17 additions and 20 deletions

View file

@ -532,10 +532,7 @@ const fetchTimeline = ({
return fetch(url, { headers: authHeaders(credentials) })
.then((data) => {
if (data.ok || data.status === 403) {
return data
}
throw new Error('Error fetching timeline', data)
return data
})
.then((data) => data.json())
.then((data) => {

View file

@ -6,7 +6,7 @@ const update = ({ store, statuses, timeline, showImmediately, userId }) => {
const ccTimeline = camelCase(timeline)
store.dispatch('setError', { value: false })
store.dispatch('set403Error', { value: false })
store.dispatch('setErrorData', { value: false })
store.dispatch('addNewStatuses', {
timeline: ccTimeline,
@ -46,9 +46,9 @@ const fetchAndUpdate = ({
return apiService.fetchTimeline(args)
.then((statuses) => {
// Change messaging if not public
if (statuses.error) {
store.dispatch('set403Error', { value: statuses.error })
console.log(statuses)
store.dispatch('setErrorData', { value: statuses.error })
return
}
if (!older && statuses.length >= 20 && !timelineData.loading && numStatusesBeforeFetch > 0) {