Commit 8ee80339 authored by Wyatt Benno's avatar Wyatt Benno

Set error data

parent 1a043d43
Pipeline #20857 passed with stages
in 3 minutes and 56 seconds
......@@ -16,7 +16,7 @@
class="loadmore-error alert error"
@click.prevent
>
{{ $t('timeline.error_403') }}
{{ errorData.statusText }}
</div>
<button
v-if="timeline.newStatusCount > 0 && !timelineError && !errorData"
......@@ -84,7 +84,7 @@
v-else-if="errorData"
href="#"
>
<div class="new-status-notification text-center panel-footer">{{ errorData }}</div>
<div class="new-status-notification text-center panel-footer">{{ errorData.error }}</div>
</a>
<div
v-else
......
......@@ -535,7 +535,6 @@
"collapse": "Collapse",
"conversation": "Conversation",
"error_fetching": "Error fetching updates",
"error_403": "Access denied",
"load_older": "Load older statuses",
"no_retweet_hint": "Post is marked as followers-only or direct and cannot be repeated",
"repeated": "repeated",
......
......@@ -38,7 +38,7 @@ export const defaultState = () => ({
notifications: emptyNotifications(),
favorites: new Set(),
error: false,
errorData: '',
errorData: null,
timelines: {
mentions: emptyTl(),
public: emptyTl(),
......
......@@ -529,9 +529,12 @@ const fetchTimeline = ({
const queryString = map(params, (param) => `${param[0]}=${param[1]}`).join('&')
url += `?${queryString}`
let status = ''
let statusText = ''
return fetch(url, { headers: authHeaders(credentials) })
.then((data) => {
status = data.status
statusText = data.statusText
return data
})
.then((data) => data.json())
......@@ -539,6 +542,8 @@ const fetchTimeline = ({
if (!data.error) {
return data.map(isNotifications ? parseNotification : parseStatus)
} else {
data.status = status
data.statusText = statusText
return data
}
})
......
......@@ -6,7 +6,7 @@ const update = ({ store, statuses, timeline, showImmediately, userId }) => {
const ccTimeline = camelCase(timeline)
store.dispatch('setError', { value: false })
store.dispatch('setErrorData', { value: false })
store.dispatch('setErrorData', { value: null })
store.dispatch('addNewStatuses', {
timeline: ccTimeline,
......@@ -47,7 +47,7 @@ const fetchAndUpdate = ({
return apiService.fetchTimeline(args)
.then((statuses) => {
if (statuses.error) {
store.dispatch('setErrorData', { value: statuses.error })
store.dispatch('setErrorData', { value: statuses })
return
}
if (!older && statuses.length >= 20 && !timelineData.loading && numStatusesBeforeFetch > 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment