Set error data
This commit is contained in:
parent
1a043d4350
commit
8ee8033955
5 changed files with 11 additions and 7 deletions
|
@ -16,7 +16,7 @@
|
||||||
class="loadmore-error alert error"
|
class="loadmore-error alert error"
|
||||||
@click.prevent
|
@click.prevent
|
||||||
>
|
>
|
||||||
{{ $t('timeline.error_403') }}
|
{{ errorData.statusText }}
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
v-if="timeline.newStatusCount > 0 && !timelineError && !errorData"
|
v-if="timeline.newStatusCount > 0 && !timelineError && !errorData"
|
||||||
|
@ -84,7 +84,7 @@
|
||||||
v-else-if="errorData"
|
v-else-if="errorData"
|
||||||
href="#"
|
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>
|
</a>
|
||||||
<div
|
<div
|
||||||
v-else
|
v-else
|
||||||
|
|
|
@ -535,7 +535,6 @@
|
||||||
"collapse": "Collapse",
|
"collapse": "Collapse",
|
||||||
"conversation": "Conversation",
|
"conversation": "Conversation",
|
||||||
"error_fetching": "Error fetching updates",
|
"error_fetching": "Error fetching updates",
|
||||||
"error_403": "Access denied",
|
|
||||||
"load_older": "Load older statuses",
|
"load_older": "Load older statuses",
|
||||||
"no_retweet_hint": "Post is marked as followers-only or direct and cannot be repeated",
|
"no_retweet_hint": "Post is marked as followers-only or direct and cannot be repeated",
|
||||||
"repeated": "repeated",
|
"repeated": "repeated",
|
||||||
|
|
|
@ -38,7 +38,7 @@ export const defaultState = () => ({
|
||||||
notifications: emptyNotifications(),
|
notifications: emptyNotifications(),
|
||||||
favorites: new Set(),
|
favorites: new Set(),
|
||||||
error: false,
|
error: false,
|
||||||
errorData: '',
|
errorData: null,
|
||||||
timelines: {
|
timelines: {
|
||||||
mentions: emptyTl(),
|
mentions: emptyTl(),
|
||||||
public: emptyTl(),
|
public: emptyTl(),
|
||||||
|
|
|
@ -529,9 +529,12 @@ const fetchTimeline = ({
|
||||||
|
|
||||||
const queryString = map(params, (param) => `${param[0]}=${param[1]}`).join('&')
|
const queryString = map(params, (param) => `${param[0]}=${param[1]}`).join('&')
|
||||||
url += `?${queryString}`
|
url += `?${queryString}`
|
||||||
|
let status = ''
|
||||||
|
let statusText = ''
|
||||||
return fetch(url, { headers: authHeaders(credentials) })
|
return fetch(url, { headers: authHeaders(credentials) })
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
|
status = data.status
|
||||||
|
statusText = data.statusText
|
||||||
return data
|
return data
|
||||||
})
|
})
|
||||||
.then((data) => data.json())
|
.then((data) => data.json())
|
||||||
|
@ -539,6 +542,8 @@ const fetchTimeline = ({
|
||||||
if (!data.error) {
|
if (!data.error) {
|
||||||
return data.map(isNotifications ? parseNotification : parseStatus)
|
return data.map(isNotifications ? parseNotification : parseStatus)
|
||||||
} else {
|
} else {
|
||||||
|
data.status = status
|
||||||
|
data.statusText = statusText
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -6,7 +6,7 @@ const update = ({ store, statuses, timeline, showImmediately, userId }) => {
|
||||||
const ccTimeline = camelCase(timeline)
|
const ccTimeline = camelCase(timeline)
|
||||||
|
|
||||||
store.dispatch('setError', { value: false })
|
store.dispatch('setError', { value: false })
|
||||||
store.dispatch('setErrorData', { value: false })
|
store.dispatch('setErrorData', { value: null })
|
||||||
|
|
||||||
store.dispatch('addNewStatuses', {
|
store.dispatch('addNewStatuses', {
|
||||||
timeline: ccTimeline,
|
timeline: ccTimeline,
|
||||||
|
@ -47,7 +47,7 @@ const fetchAndUpdate = ({
|
||||||
return apiService.fetchTimeline(args)
|
return apiService.fetchTimeline(args)
|
||||||
.then((statuses) => {
|
.then((statuses) => {
|
||||||
if (statuses.error) {
|
if (statuses.error) {
|
||||||
store.dispatch('setErrorData', { value: statuses.error })
|
store.dispatch('setErrorData', { value: statuses })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!older && statuses.length >= 20 && !timelineData.loading && numStatusesBeforeFetch > 0) {
|
if (!older && statuses.length >= 20 && !timelineData.loading && numStatusesBeforeFetch > 0) {
|
||||||
|
|
Loading…
Reference in a new issue