Fixed "user.id is undefined" or something error more sane by properly handling
HTTP errors
This commit is contained in:
parent
e53f238278
commit
03f28d3fa6
@ -335,7 +335,14 @@ const fetchTimeline = ({timeline, credentials, since = false, until = false, use
|
||||
const queryString = map(params, (param) => `${param[0]}=${param[1]}`).join('&')
|
||||
url += `?${queryString}`
|
||||
|
||||
return fetch(url, { headers: authHeaders(credentials) }).then((data) => data.json())
|
||||
return fetch(url, { headers: authHeaders(credentials) })
|
||||
.then((data) => {
|
||||
if (data.ok) {
|
||||
return data
|
||||
}
|
||||
throw new Error('Error fetching timeline')
|
||||
})
|
||||
.then((data) => data.json())
|
||||
}
|
||||
|
||||
const verifyCredentials = (user) => {
|
||||
|
Loading…
Reference in New Issue
Block a user