aboutsummaryrefslogtreecommitdiff
path: root/src/services/api/api.service.js
diff options
context:
space:
mode:
authorlambda <pleromagit@rogerbraun.net>2018-06-08 13:30:49 +0000
committerlambda <pleromagit@rogerbraun.net>2018-06-08 13:30:49 +0000
commitaf47d51cd14503495c1ee7398ba733ad4c5ed4a4 (patch)
treebf2b0df49756e72800a0f34bd5c26d4fb9beabeb /src/services/api/api.service.js
parent9b86fc4dcd05a8f63ff564e117f06caf8046be78 (diff)
parente2c5e4eb46143b52ccff21ca0914c5f1b79376fa (diff)
Merge branch 'develop' into 'patch-1'
# Conflicts: # src/i18n/messages.js
Diffstat (limited to 'src/services/api/api.service.js')
-rw-r--r--src/services/api/api.service.js38
1 files changed, 36 insertions, 2 deletions
diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js
index f14bfd6d..0d91851b 100644
--- a/src/services/api/api.service.js
+++ b/src/services/api/api.service.js
@@ -30,6 +30,8 @@ const BLOCKING_URL = '/api/blocks/create.json'
const UNBLOCKING_URL = '/api/blocks/destroy.json'
const USER_URL = '/api/users/show.json'
const FOLLOW_IMPORT_URL = '/api/pleroma/follow_import'
+const DELETE_ACCOUNT_URL = '/api/pleroma/delete_account'
+const CHANGE_PASSWORD_URL = '/api/pleroma/change_password'
import { each, map } from 'lodash'
import 'whatwg-fetch'
@@ -329,12 +331,14 @@ const retweet = ({ id, credentials }) => {
})
}
-const postStatus = ({credentials, status, mediaIds, inReplyToStatusId}) => {
+const postStatus = ({credentials, status, spoilerText, visibility, mediaIds, inReplyToStatusId}) => {
const idsText = mediaIds.join(',')
const form = new FormData()
form.append('status', status)
form.append('source', 'Pleroma FE')
+ if (spoilerText) form.append('spoiler_text', spoilerText)
+ if (visibility) form.append('visibility', visibility)
form.append('media_ids', idsText)
if (inReplyToStatusId) {
form.append('in_reply_to_status_id', inReplyToStatusId)
@@ -373,6 +377,34 @@ const followImport = ({params, credentials}) => {
.then((response) => response.ok)
}
+const deleteAccount = ({credentials, password}) => {
+ const form = new FormData()
+
+ form.append('password', password)
+
+ return fetch(DELETE_ACCOUNT_URL, {
+ body: form,
+ method: 'POST',
+ headers: authHeaders(credentials)
+ })
+ .then((response) => response.json())
+}
+
+const changePassword = ({credentials, password, newPassword, newPasswordConfirmation}) => {
+ const form = new FormData()
+
+ form.append('password', password)
+ form.append('new_password', newPassword)
+ form.append('new_password_confirmation', newPasswordConfirmation)
+
+ return fetch(CHANGE_PASSWORD_URL, {
+ body: form,
+ method: 'POST',
+ headers: authHeaders(credentials)
+ })
+ .then((response) => response.json())
+}
+
const fetchMutes = ({credentials}) => {
const url = '/api/qvitter/mutes.json'
@@ -408,7 +440,9 @@ const apiService = {
updateProfile,
updateBanner,
externalProfile,
- followImport
+ followImport,
+ deleteAccount,
+ changePassword
}
export default apiService