diff options
Diffstat (limited to 'src/services')
| -rw-r--r-- | src/services/api/api.service.js | 10 | ||||
| -rw-r--r-- | src/services/status_poster/status_poster.service.js | 6 |
2 files changed, 12 insertions, 4 deletions
diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index 40ea5bd9..da519001 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -631,7 +631,8 @@ const postStatus = ({ mediaIds = [], inReplyToStatusId, contentType, - preview + preview, + idempotencyKey }) => { const form = new FormData() const pollOptions = poll.options || [] @@ -665,10 +666,15 @@ const postStatus = ({ form.append('preview', 'true') } + let postHeaders = authHeaders(credentials) + if (idempotencyKey) { + postHeaders['idempotency-key'] = idempotencyKey + } + return fetch(MASTODON_POST_STATUS_URL, { body: form, method: 'POST', - headers: authHeaders(credentials) + headers: postHeaders }) .then((response) => { return response.json() diff --git a/src/services/status_poster/status_poster.service.js b/src/services/status_poster/status_poster.service.js index ac469175..f09196aa 100644 --- a/src/services/status_poster/status_poster.service.js +++ b/src/services/status_poster/status_poster.service.js @@ -11,7 +11,8 @@ const postStatus = ({ media = [], inReplyToStatusId = undefined, contentType = 'text/plain', - preview = false + preview = false, + idempotencyKey = '' }) => { const mediaIds = map(media, 'id') @@ -25,7 +26,8 @@ const postStatus = ({ inReplyToStatusId, contentType, poll, - preview + preview, + idempotencyKey }) .then((data) => { if (!data.error && !preview) { |
