Merge remote-tracking branch 'origin/develop' into users-statuses-pinia
This commit is contained in:
commit
657f405ee0
27 changed files with 167 additions and 20 deletions
|
|
@ -67,6 +67,7 @@ export const promisedRequest = async ({
|
|||
url,
|
||||
payload,
|
||||
formData,
|
||||
forceContentType,
|
||||
cache,
|
||||
credentials,
|
||||
headers = {},
|
||||
|
|
@ -75,7 +76,7 @@ export const promisedRequest = async ({
|
|||
method,
|
||||
credentials: 'same-origin',
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
Accept: forceContentType ?? 'application/json',
|
||||
...headers,
|
||||
},
|
||||
}
|
||||
|
|
@ -110,7 +111,7 @@ export const promisedRequest = async ({
|
|||
)
|
||||
if (contentLength === 0) return null
|
||||
|
||||
switch (contentType) {
|
||||
switch (forceContentType ?? contentType) {
|
||||
case 'text/plain':
|
||||
return await response.text()
|
||||
case 'application/json':
|
||||
|
|
|
|||
|
|
@ -117,9 +117,17 @@ export const fetchUserByName = ({ name, credentials }) =>
|
|||
|
||||
export const fetchFriends = ({ id, maxId, sinceId, limit = 20, credentials }) =>
|
||||
promisedRequest({
|
||||
url: MASTODON_FOLLOWING_URL(id, { maxId, sinceId, limit }),
|
||||
url: MASTODON_FOLLOWING_URL(id, {
|
||||
maxId,
|
||||
sinceId,
|
||||
limit,
|
||||
withRelationships: true,
|
||||
}),
|
||||
credentials,
|
||||
}).then(({ data, ...rest }) => ({ ...rest, data: data.map(parseUser) }))
|
||||
}).then(({ data, ...rest }) => ({
|
||||
...rest,
|
||||
data: data.map(parseUser),
|
||||
}))
|
||||
|
||||
export const fetchFollowers = ({
|
||||
id,
|
||||
|
|
@ -136,7 +144,10 @@ export const fetchFollowers = ({
|
|||
withRelationships: true,
|
||||
}),
|
||||
credentials,
|
||||
}).then(({ data, ...rest }) => ({ ...rest, data: data.map(parseUser) }))
|
||||
}).then(({ data, ...rest }) => ({
|
||||
...rest,
|
||||
data: data.map(parseUser),
|
||||
}))
|
||||
|
||||
export const fetchConversation = ({ id, credentials }) =>
|
||||
promisedRequest({
|
||||
|
|
|
|||
|
|
@ -410,7 +410,6 @@ export const exportFriends = ({ id, credentials }) => {
|
|||
id,
|
||||
maxId,
|
||||
credentials,
|
||||
withRelationships: true,
|
||||
})
|
||||
friends = [...friends, ...users]
|
||||
if (users.length === 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue