diff options
| author | Henry Jameson <me@hjkos.com> | 2019-11-08 19:48:31 +0200 |
|---|---|---|
| committer | Henry Jameson <me@hjkos.com> | 2019-11-08 19:48:31 +0200 |
| commit | 0dcb696e26dfcf97ad46e533ed4797bc9364fc01 (patch) | |
| tree | 2d7b5e7d43b92eb36a9b170e9c5e32dda5d2b7b4 /src/services/api/api.service.js | |
| parent | 6ade3be5b40816f8765e657442aa2945e51ce7d4 (diff) | |
| parent | 632773ba91ef021dd589ab4d2037f5e0ed7ca5b2 (diff) | |
Merge remote-tracking branch 'upstream/develop' into emoji-optimizations
* upstream/develop: (95 commits)
Lightbox/modal multi image improvements - #381
'/api/pleroma/profile/mfa' -> '/api/pleroma/accounts/mfa'
Add ability to change user's email
translations-de-batch-1
eu-translate update
profile-banner rounding css, fixes #690
fix indentation
remove needless ref
show preview popover when hover numbered replies
refactor conditions
do not make too many nested div
add fetchStatus action
refactor status loading logic
split status preview popover into a separate component
uninstall mobile-detect library
listen both events
minor css fix
restrict distance at top side only
set different trigger event in desktop and mobile by default
fix eslint warnings
...
Diffstat (limited to 'src/services/api/api.service.js')
| -rw-r--r-- | src/services/api/api.service.js | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index 887d7d7a..8f5eb416 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -8,6 +8,7 @@ const QVITTER_USER_NOTIFICATIONS_READ_URL = '/api/qvitter/statuses/notifications const BLOCKS_IMPORT_URL = '/api/pleroma/blocks_import' const FOLLOW_IMPORT_URL = '/api/pleroma/follow_import' const DELETE_ACCOUNT_URL = '/api/pleroma/delete_account' +const CHANGE_EMAIL_URL = '/api/pleroma/change_email' const CHANGE_PASSWORD_URL = '/api/pleroma/change_password' const TAG_USER_URL = '/api/pleroma/admin/users/tag' const PERMISSION_GROUP_URL = (screenName, right) => `/api/pleroma/admin/users/${screenName}/permission_group/${right}` @@ -16,12 +17,12 @@ const ADMIN_USERS_URL = '/api/pleroma/admin/users' const SUGGESTIONS_URL = '/api/v1/suggestions' const NOTIFICATION_SETTINGS_URL = '/api/pleroma/notification_settings' -const MFA_SETTINGS_URL = '/api/pleroma/profile/mfa' -const MFA_BACKUP_CODES_URL = '/api/pleroma/profile/mfa/backup_codes' +const MFA_SETTINGS_URL = '/api/pleroma/accounts/mfa' +const MFA_BACKUP_CODES_URL = '/api/pleroma/accounts/mfa/backup_codes' -const MFA_SETUP_OTP_URL = '/api/pleroma/profile/mfa/setup/totp' -const MFA_CONFIRM_OTP_URL = '/api/pleroma/profile/mfa/confirm/totp' -const MFA_DISABLE_OTP_URL = '/api/pleroma/profile/mfa/totp' +const MFA_SETUP_OTP_URL = '/api/pleroma/accounts/mfa/setup/totp' +const MFA_CONFIRM_OTP_URL = '/api/pleroma/accounts/mfa/confirm/totp' +const MFA_DISABLE_OTP_URL = '/api/pleroma/account/mfa/totp' const MASTODON_LOGIN_URL = '/api/v1/accounts/verify_credentials' const MASTODON_REGISTRATION_URL = '/api/v1/accounts' @@ -219,10 +220,16 @@ const authHeaders = (accessToken) => { } } -const followUser = ({ id, credentials }) => { +const followUser = ({ id, credentials, ...options }) => { let url = MASTODON_FOLLOW_URL(id) + const form = {} + if (options.reblogs !== undefined) { form['reblogs'] = options.reblogs } return fetch(url, { - headers: authHeaders(credentials), + body: JSON.stringify(form), + headers: { + ...authHeaders(credentials), + 'Content-Type': 'application/json' + }, method: 'POST' }).then((data) => data.json()) } @@ -685,6 +692,20 @@ const deleteAccount = ({ credentials, password }) => { .then((response) => response.json()) } +const changeEmail = ({ credentials, email, password }) => { + const form = new FormData() + + form.append('email', email) + form.append('password', password) + + return fetch(CHANGE_EMAIL_URL, { + body: form, + method: 'POST', + headers: authHeaders(credentials) + }) + .then((response) => response.json()) +} + const changePassword = ({ credentials, password, newPassword, newPasswordConfirmation }) => { const form = new FormData() @@ -960,6 +981,7 @@ const apiService = { importBlocks, importFollows, deleteAccount, + changeEmail, changePassword, settingsMFA, mfaDisableOTP, |
