aboutsummaryrefslogtreecommitdiff
path: root/src/services
diff options
context:
space:
mode:
Diffstat (limited to 'src/services')
-rw-r--r--src/services/api/api.service.js19
-rw-r--r--src/services/backend_interactor_service/backend_interactor_service.js4
2 files changed, 21 insertions, 2 deletions
diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js
index fd401068..65761aee 100644
--- a/src/services/api/api.service.js
+++ b/src/services/api/api.service.js
@@ -31,6 +31,7 @@ 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'
@@ -387,6 +388,21 @@ const deleteAccount = ({credentials, password}) => {
.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'
@@ -423,7 +439,8 @@ const apiService = {
updateBanner,
externalProfile,
followImport,
- deleteAccount
+ deleteAccount,
+ changePassword
}
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 c5807bed..14173558 100644
--- a/src/services/backend_interactor_service/backend_interactor_service.js
+++ b/src/services/backend_interactor_service/backend_interactor_service.js
@@ -62,6 +62,7 @@ const backendInteractorService = (credentials) => {
const followImport = ({params}) => apiService.followImport({params, credentials})
const deleteAccount = ({password}) => apiService.deleteAccount({credentials, password})
+ const changePassword = ({password, newPassword, newPasswordConfirmation}) => apiService.changePassword({credentials, password, newPassword, newPasswordConfirmation})
const backendInteractorServiceInstance = {
fetchStatus,
@@ -85,7 +86,8 @@ const backendInteractorService = (credentials) => {
updateProfile,
externalProfile,
followImport,
- deleteAccount
+ deleteAccount,
+ changePassword
}
return backendInteractorServiceInstance