diff options
Diffstat (limited to 'src/services')
| -rw-r--r-- | src/services/api/api.service.js | 17 | ||||
| -rw-r--r-- | src/services/backend_interactor_service/backend_interactor_service.js | 5 |
2 files changed, 20 insertions, 2 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 diff --git a/src/services/backend_interactor_service/backend_interactor_service.js b/src/services/backend_interactor_service/backend_interactor_service.js index 52b8286b..c5807bed 100644 --- a/src/services/backend_interactor_service/backend_interactor_service.js +++ b/src/services/backend_interactor_service/backend_interactor_service.js @@ -61,6 +61,8 @@ const backendInteractorService = (credentials) => { const externalProfile = (profileUrl) => apiService.externalProfile({profileUrl, credentials}) const followImport = ({params}) => apiService.followImport({params, credentials}) + const deleteAccount = ({password}) => apiService.deleteAccount({credentials, password}) + const backendInteractorServiceInstance = { fetchStatus, fetchConversation, @@ -82,7 +84,8 @@ const backendInteractorService = (credentials) => { updateBanner, updateProfile, externalProfile, - followImport + followImport, + deleteAccount } return backendInteractorServiceInstance |
