diff options
| author | HJ <30-hj@users.noreply.git.pleroma.social> | 2019-05-09 17:17:26 +0000 |
|---|---|---|
| committer | HJ <30-hj@users.noreply.git.pleroma.social> | 2019-05-09 17:17:26 +0000 |
| commit | cd67b1f49614c38bf6e530509826a731653ea329 (patch) | |
| tree | fefe6ac0f0f0932e99e99a8f0a8bba7bf1191583 /src/services/api/api.service.js | |
| parent | 177e53cf6a93e4a00ed0ed979f89789340fb8f51 (diff) | |
| parent | 7d60ab322ed996b067242c3f047f90814f9c8f7c (diff) | |
Merge branch '527' into 'develop'
Fix "Liking/reprööting posts while post is highlighted in conversation fails to update the liked/reprööted status"
Closes #527
See merge request pleroma/pleroma-fe!787
Diffstat (limited to 'src/services/api/api.service.js')
| -rw-r--r-- | src/services/api/api.service.js | 48 |
1 files changed, 4 insertions, 44 deletions
diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index da44fc54..b7a602b8 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -506,62 +506,22 @@ const verifyCredentials = (user) => { } const favorite = ({ id, credentials }) => { - return fetch(MASTODON_FAVORITE_URL(id), { - headers: authHeaders(credentials), - method: 'POST' - }) - .then(response => { - if (response.ok) { - return response.json() - } else { - throw new Error('Error favoriting post') - } - }) + return promisedRequest({ url: MASTODON_FAVORITE_URL(id), method: 'POST', credentials }) .then((data) => parseStatus(data)) } const unfavorite = ({ id, credentials }) => { - return fetch(MASTODON_UNFAVORITE_URL(id), { - headers: authHeaders(credentials), - method: 'POST' - }) - .then(response => { - if (response.ok) { - return response.json() - } else { - throw new Error('Error removing favorite') - } - }) + return promisedRequest({ url: MASTODON_UNFAVORITE_URL(id), method: 'POST', credentials }) .then((data) => parseStatus(data)) } const retweet = ({ id, credentials }) => { - return fetch(MASTODON_RETWEET_URL(id), { - headers: authHeaders(credentials), - method: 'POST' - }) - .then(response => { - if (response.ok) { - return response.json() - } else { - throw new Error('Error repeating post') - } - }) + return promisedRequest({ url: MASTODON_RETWEET_URL(id), method: 'POST', credentials }) .then((data) => parseStatus(data)) } const unretweet = ({ id, credentials }) => { - return fetch(MASTODON_UNRETWEET_URL(id), { - headers: authHeaders(credentials), - method: 'POST' - }) - .then(response => { - if (response.ok) { - return response.json() - } else { - throw new Error('Error removing repeat') - } - }) + return promisedRequest({ url: MASTODON_UNRETWEET_URL(id), method: 'POST', credentials }) .then((data) => parseStatus(data)) } |
