aboutsummaryrefslogtreecommitdiff
path: root/src/services/api/api.service.js
diff options
context:
space:
mode:
authorSyldexia <syldexia@ofthewi.red>2018-05-13 15:09:07 +0100
committer= <=syldexia@ofthewi.red>2018-05-13 15:24:42 +0100
commit327b6fb5dcbabf5de61e1ce0fa6c65329a8ec45b (patch)
treee52d003d0426eae88a9e1c722858431a5744c38e /src/services/api/api.service.js
parent8f58526bbccdca6019bdd66126a3fb7a148bd951 (diff)
Added delete account section to user settings
Diffstat (limited to 'src/services/api/api.service.js')
-rw-r--r--src/services/api/api.service.js17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js
index f14bfd6d..fd401068 100644
--- a/src/services/api/api.service.js
+++ b/src/services/api/api.service.js
@@ -30,6 +30,7 @@ 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'
import { each, map } from 'lodash'
import 'whatwg-fetch'
@@ -373,6 +374,19 @@ 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 fetchMutes = ({credentials}) => {
const url = '/api/qvitter/mutes.json'
@@ -408,7 +422,8 @@ const apiService = {
updateProfile,
updateBanner,
externalProfile,
- followImport
+ followImport,
+ deleteAccount
}
export default apiService