aboutsummaryrefslogtreecommitdiff
path: root/src/services/api/api.service.js
diff options
context:
space:
mode:
authorHenry Jameson <me@hjkos.com>2023-04-12 23:31:11 +0300
committerHenry Jameson <me@hjkos.com>2023-04-12 23:31:11 +0300
commit3e1aeb6d2c9b540271bd0d7890ab424cb27422ae (patch)
treecc8a9c3a63c92bd1a55b849c5380f52e0a58c9a0 /src/services/api/api.service.js
parent9e5c7313c64c9f9eeff7184f5f474cc055d80715 (diff)
parentbc830cd03365387b30a2900d133155bf3858f1fe (diff)
Merge remote-tracking branch 'origin/develop' into improve_settings_reusability
Diffstat (limited to 'src/services/api/api.service.js')
-rw-r--r--src/services/api/api.service.js25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js
index 56e7de71..ac715678 100644
--- a/src/services/api/api.service.js
+++ b/src/services/api/api.service.js
@@ -845,7 +845,7 @@ const postStatus = ({
})
if (pollOptions.some(option => option !== '')) {
const normalizedPoll = {
- expires_in: poll.expiresIn,
+ expires_in: parseInt(poll.expiresIn, 10),
multiple: poll.multiple
}
Object.keys(normalizedPoll).forEach(key => {
@@ -902,7 +902,7 @@ const editStatus = ({
if (pollOptions.some(option => option !== '')) {
const normalizedPoll = {
- expires_in: poll.expiresIn,
+ expires_in: parseInt(poll.expiresIn, 10),
multiple: poll.multiple
}
Object.keys(normalizedPoll).forEach(key => {
@@ -928,8 +928,9 @@ const editStatus = ({
}
const deleteStatus = ({ id, credentials }) => {
- return fetch(MASTODON_DELETE_URL(id), {
- headers: authHeaders(credentials),
+ return promisedRequest({
+ url: MASTODON_DELETE_URL(id),
+ credentials,
method: 'DELETE'
})
}
@@ -1118,8 +1119,12 @@ const generateMfaBackupCodes = ({ credentials }) => {
}).then((data) => data.json())
}
-const fetchMutes = ({ credentials }) => {
- return promisedRequest({ url: MASTODON_USER_MUTES_URL, credentials })
+const fetchMutes = ({ maxId, credentials }) => {
+ const query = new URLSearchParams({ with_relationships: true })
+ if (maxId) {
+ query.append('max_id', maxId)
+ }
+ return promisedRequest({ url: `${MASTODON_USER_MUTES_URL}?${query.toString()}`, credentials })
.then((users) => users.map(parseUser))
}
@@ -1143,8 +1148,12 @@ const unsubscribeUser = ({ id, credentials }) => {
return promisedRequest({ url: MASTODON_UNSUBSCRIBE_USER(id), credentials, method: 'POST' })
}
-const fetchBlocks = ({ credentials }) => {
- return promisedRequest({ url: MASTODON_USER_BLOCKS_URL, credentials })
+const fetchBlocks = ({ maxId, credentials }) => {
+ const query = new URLSearchParams({ with_relationships: true })
+ if (maxId) {
+ query.append('max_id', maxId)
+ }
+ return promisedRequest({ url: `${MASTODON_USER_BLOCKS_URL}?${query.toString()}`, credentials })
.then((users) => users.map(parseUser))
}