fix status fetching
This commit is contained in:
parent
941211ea6c
commit
e5c27fccc6
1 changed files with 12 additions and 24 deletions
|
|
@ -524,42 +524,33 @@ export const fetchConversation = ({ id, credentials }) =>
|
||||||
url: MASTODON_STATUS_CONTEXT_URL(id),
|
url: MASTODON_STATUS_CONTEXT_URL(id),
|
||||||
credentials,
|
credentials,
|
||||||
})
|
})
|
||||||
.then((data) => {
|
|
||||||
if (data.ok) {
|
|
||||||
return data
|
|
||||||
}
|
|
||||||
throw new Error('Error fetching timeline', data)
|
|
||||||
})
|
|
||||||
.then(({ ancestors, descendants }) => ({
|
.then(({ ancestors, descendants }) => ({
|
||||||
ancestors: ancestors.map(parseStatus),
|
ancestors: ancestors.map(parseStatus),
|
||||||
descendants: descendants.map(parseStatus),
|
descendants: descendants.map(parseStatus),
|
||||||
}))
|
}))
|
||||||
|
.catch((error) => {
|
||||||
|
throw new Error('Error fetching timeline', error)
|
||||||
|
})
|
||||||
|
|
||||||
export const fetchStatus = ({ id, credentials }) =>
|
export const fetchStatus = ({ id, credentials }) =>
|
||||||
promisedRequest({
|
promisedRequest({
|
||||||
url: MASTODON_STATUS_URL(id),
|
url: MASTODON_STATUS_URL(id),
|
||||||
credentials,
|
credentials,
|
||||||
})
|
})
|
||||||
.then((data) => {
|
|
||||||
if (data.ok) {
|
|
||||||
return data
|
|
||||||
}
|
|
||||||
throw new Error('Error fetching timeline', { cause: data })
|
|
||||||
})
|
|
||||||
.then((data) => parseStatus(data))
|
.then((data) => parseStatus(data))
|
||||||
|
.catch((error) => {
|
||||||
|
throw new Error('Error fetching timeline', error)
|
||||||
|
})
|
||||||
|
|
||||||
export const fetchStatusSource = ({ id, credentials }) =>
|
export const fetchStatusSource = ({ id, credentials }) =>
|
||||||
promisedRequest({
|
promisedRequest({
|
||||||
url: MASTODON_STATUS_SOURCE_URL(id),
|
url: MASTODON_STATUS_SOURCE_URL(id),
|
||||||
credentials,
|
credentials,
|
||||||
})
|
})
|
||||||
.then((data) => {
|
|
||||||
if (data.ok) {
|
|
||||||
return data
|
|
||||||
}
|
|
||||||
throw new Error('Error fetching source', { cause: data })
|
|
||||||
})
|
|
||||||
.then((data) => parseSource(data))
|
.then((data) => parseSource(data))
|
||||||
|
.catch((error) => {
|
||||||
|
throw new Error('Error fetching timeline', error)
|
||||||
|
})
|
||||||
|
|
||||||
export const fetchStatusHistory = ({ status, credentials }) =>
|
export const fetchStatusHistory = ({ status, credentials }) =>
|
||||||
promisedRequest({
|
promisedRequest({
|
||||||
|
|
@ -1281,17 +1272,14 @@ export const search2 = ({
|
||||||
url,
|
url,
|
||||||
credentials,
|
credentials,
|
||||||
})
|
})
|
||||||
.then((data) => {
|
|
||||||
if (data.ok) {
|
|
||||||
return data
|
|
||||||
}
|
|
||||||
throw new Error('Error fetching search result', data)
|
|
||||||
})
|
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
data.accounts = data.accounts.slice(0, limit).map((u) => parseUser(u))
|
data.accounts = data.accounts.slice(0, limit).map((u) => parseUser(u))
|
||||||
data.statuses = data.statuses.slice(0, limit).map((s) => parseStatus(s))
|
data.statuses = data.statuses.slice(0, limit).map((s) => parseStatus(s))
|
||||||
return data
|
return data
|
||||||
})
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
throw new Error('Error fetching timeline', error)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export const fetchKnownDomains = ({ credentials }) =>
|
export const fetchKnownDomains = ({ credentials }) =>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue