aboutsummaryrefslogtreecommitdiff
path: root/src/services
diff options
context:
space:
mode:
Diffstat (limited to 'src/services')
-rw-r--r--src/services/api/api.service.js10
-rw-r--r--src/services/timeline_fetcher/timeline_fetcher.service.js6
2 files changed, 14 insertions, 2 deletions
diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js
index 8f5eb416..a2aa802f 100644
--- a/src/services/api/api.service.js
+++ b/src/services/api/api.service.js
@@ -532,13 +532,19 @@ const fetchTimeline = ({
return fetch(url, { headers: authHeaders(credentials) })
.then((data) => {
- if (data.ok) {
+ if (data.ok || data.status === 403) {
return data
}
throw new Error('Error fetching timeline', data)
})
.then((data) => data.json())
- .then((data) => data.map(isNotifications ? parseNotification : parseStatus))
+ .then((data) => {
+ if (!data.error) {
+ return data.map(isNotifications ? parseNotification : parseStatus)
+ } else {
+ return data
+ }
+ })
}
const fetchPinnedStatuses = ({ id, credentials }) => {
diff --git a/src/services/timeline_fetcher/timeline_fetcher.service.js b/src/services/timeline_fetcher/timeline_fetcher.service.js
index 9eb30c2d..9352d73a 100644
--- a/src/services/timeline_fetcher/timeline_fetcher.service.js
+++ b/src/services/timeline_fetcher/timeline_fetcher.service.js
@@ -6,6 +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('addNewStatuses', {
timeline: ccTimeline,
@@ -45,6 +46,11 @@ const fetchAndUpdate = ({
return apiService.fetchTimeline(args)
.then((statuses) => {
+ // Change messaging if not public
+ if (statuses.error) {
+ store.dispatch('set403Error', { value: true })
+ return
+ }
if (!older && statuses.length >= 20 && !timelineData.loading && numStatusesBeforeFetch > 0) {
store.dispatch('queueFlush', { timeline: timeline, id: timelineData.maxId })
}