mirror of
https://git.pleroma.social/sjw/pleroma-fe.git
synced 2024-11-05 02:52:21 +01:00
Merge branch 'tusooa/nomore-mapundef' into 'develop'
Display better error message for unauthenticated timelines Closes #1235 and #1044 See merge request pleroma/pleroma-fe!1756
This commit is contained in:
commit
e7fb5e81c3
@ -734,26 +734,22 @@ 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 = ''
|
|
||||||
|
|
||||||
let pagination = {}
|
|
||||||
return fetch(url, { headers: authHeaders(credentials) })
|
return fetch(url, { headers: authHeaders(credentials) })
|
||||||
.then((data) => {
|
.then(async (response) => {
|
||||||
status = data.status
|
const success = response.ok
|
||||||
statusText = data.statusText
|
|
||||||
pagination = parseLinkHeaderPagination(data.headers.get('Link'), {
|
const data = await response.json()
|
||||||
flakeId: timeline !== 'bookmarks' && timeline !== 'notifications'
|
|
||||||
})
|
if (success && !data.errors) {
|
||||||
return data
|
const pagination = parseLinkHeaderPagination(response.headers.get('Link'), {
|
||||||
})
|
flakeId: timeline !== 'bookmarks' && timeline !== 'notifications'
|
||||||
.then((data) => data.json())
|
})
|
||||||
.then((data) => {
|
|
||||||
if (!data.errors) {
|
|
||||||
return { data: data.map(isNotifications ? parseNotification : parseStatus), pagination }
|
return { data: data.map(isNotifications ? parseNotification : parseStatus), pagination }
|
||||||
} else {
|
} else {
|
||||||
data.status = status
|
data.errors ||= []
|
||||||
data.statusText = statusText
|
data.status = response.status
|
||||||
|
data.statusText = response.statusText
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user