aboutsummaryrefslogtreecommitdiff
path: root/src/services/timeline_fetcher/timeline_fetcher.service.js
diff options
context:
space:
mode:
authorShpuld Shpludson <shp@cock.li>2020-11-18 11:49:54 +0000
committerShpuld Shpludson <shp@cock.li>2020-11-18 11:49:54 +0000
commitd770bab1b0e5d543547c59d86aef533f77ceafe2 (patch)
treeb8e34c857f3acf526f2f5422a995803ef85cd51a /src/services/timeline_fetcher/timeline_fetcher.service.js
parentcd784396e72dafc8442ac48635ea23f8365d83bd (diff)
parentfb5d3d32927cd9ad625203c84e8826a3544fda3e (diff)
Merge branch 'fix/timeline-error-handling-fixes' into 'develop'
Various timeline fixes See merge request pleroma/pleroma-fe!1283
Diffstat (limited to 'src/services/timeline_fetcher/timeline_fetcher.service.js')
-rw-r--r--src/services/timeline_fetcher/timeline_fetcher.service.js18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/services/timeline_fetcher/timeline_fetcher.service.js b/src/services/timeline_fetcher/timeline_fetcher.service.js
index 72ea4890..921df3ed 100644
--- a/src/services/timeline_fetcher/timeline_fetcher.service.js
+++ b/src/services/timeline_fetcher/timeline_fetcher.service.js
@@ -6,9 +6,6 @@ import { promiseInterval } from '../promise_interval/promise_interval.js'
const update = ({ store, statuses, timeline, showImmediately, userId, pagination }) => {
const ccTimeline = camelCase(timeline)
- store.dispatch('setError', { value: false })
- store.dispatch('setErrorData', { value: null })
-
store.dispatch('addNewStatuses', {
timeline: ccTimeline,
userId,
@@ -52,9 +49,8 @@ const fetchAndUpdate = ({
return apiService.fetchTimeline(args)
.then(response => {
- if (response.error) {
- store.dispatch('setErrorData', { value: response })
- return
+ if (response.errors) {
+ throw new Error(`${response.status} ${response.statusText}`)
}
const { data: statuses, pagination } = response
@@ -63,7 +59,15 @@ const fetchAndUpdate = ({
}
update({ store, statuses, timeline, showImmediately, userId, pagination })
return { statuses, pagination }
- }, () => store.dispatch('setError', { value: true }))
+ })
+ .catch((error) => {
+ store.dispatch('pushGlobalNotice', {
+ level: 'error',
+ messageKey: 'timeline.error',
+ messageArgs: [error.message],
+ timeout: 5000
+ })
+ })
}
const startFetching = ({ timeline = 'friends', credentials, store, userId = false, tag = false }) => {