implement Move activities (#26)
Reviewed-on: https://akkoma.dev/AkkomaGang/pleroma-fe/pulls/26 Co-authored-by: sfr <sol@solfisher.com> Co-committed-by: sfr <sol@solfisher.com>
This commit is contained in:
parent
101f15a078
commit
677e5325fa
5 changed files with 225 additions and 1 deletions
|
@ -9,6 +9,8 @@ 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 MOVE_ACCOUNT_URL = '/api/pleroma/move_account'
|
||||
const ALIASES_URL = '/api/pleroma/aliases'
|
||||
const TAG_USER_URL = '/api/pleroma/admin/users/tag'
|
||||
const PERMISSION_GROUP_URL = (screenName, right) => `/api/pleroma/admin/users/${screenName}/permission_group/${right}`
|
||||
const ACTIVATE_USER_URL = '/api/pleroma/admin/users/activate'
|
||||
|
@ -897,6 +899,49 @@ const changeEmail = ({ credentials, email, password }) => {
|
|||
.then((response) => response.json())
|
||||
}
|
||||
|
||||
const moveAccount = ({ credentials, password, targetAccount }) => {
|
||||
const form = new FormData()
|
||||
|
||||
form.append('password', password)
|
||||
form.append('target_account', targetAccount)
|
||||
|
||||
return fetch(MOVE_ACCOUNT_URL, {
|
||||
body: form,
|
||||
method: 'POST',
|
||||
headers: authHeaders(credentials)
|
||||
})
|
||||
.then((response) => response.json())
|
||||
}
|
||||
|
||||
const addAlias = ({ credentials, alias }) => {
|
||||
return promisedRequest({
|
||||
url: ALIASES_URL,
|
||||
method: 'PUT',
|
||||
credentials,
|
||||
payload: { alias }
|
||||
})
|
||||
}
|
||||
|
||||
const deleteAlias = ({ credentials, alias }) => {
|
||||
return promisedRequest({
|
||||
url: ALIASES_URL,
|
||||
method: 'DELETE',
|
||||
credentials,
|
||||
payload: { alias }
|
||||
})
|
||||
}
|
||||
|
||||
const listAliases = ({ credentials }) => {
|
||||
return promisedRequest({
|
||||
url: ALIASES_URL,
|
||||
method: 'GET',
|
||||
credentials,
|
||||
params: {
|
||||
_cacheBooster: (new Date()).getTime()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const changePassword = ({ credentials, password, newPassword, newPasswordConfirmation }) => {
|
||||
const form = new FormData()
|
||||
|
||||
|
@ -1461,6 +1506,10 @@ const apiService = {
|
|||
importFollows,
|
||||
deleteAccount,
|
||||
changeEmail,
|
||||
moveAccount,
|
||||
addAlias,
|
||||
deleteAlias,
|
||||
listAliases,
|
||||
changePassword,
|
||||
settingsMFA,
|
||||
mfaDisableOTP,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue