api: add approveUser and denyUser functions
This commit is contained in:
parent
4efb528a52
commit
2cf28acfd1
1 changed files with 21 additions and 1 deletions
|
@ -33,6 +33,8 @@ const FOLLOW_IMPORT_URL = '/api/pleroma/follow_import'
|
|||
const DELETE_ACCOUNT_URL = '/api/pleroma/delete_account'
|
||||
const CHANGE_PASSWORD_URL = '/api/pleroma/change_password'
|
||||
const FOLLOW_REQUESTS_URL = '/api/pleroma/friend_requests'
|
||||
const APPROVE_USER_URL = '/api/pleroma/friendships/approve'
|
||||
const DENY_USER_URL = '/api/pleroma/friendships/deny'
|
||||
|
||||
import { each, map } from 'lodash'
|
||||
import 'whatwg-fetch'
|
||||
|
@ -219,6 +221,22 @@ const unblockUser = ({id, credentials}) => {
|
|||
}).then((data) => data.json())
|
||||
}
|
||||
|
||||
const approveUser = ({id, credentials}) => {
|
||||
let url = `${APPROVE_USER_URL}?user_id=${id}`
|
||||
return fetch(url, {
|
||||
headers: authHeaders(credentials),
|
||||
method: 'POST'
|
||||
}).then((data) => data.json())
|
||||
}
|
||||
|
||||
const denyUser = ({id, credentials}) => {
|
||||
let url = `${DENY_USER_URL}?user_id=${id}`
|
||||
return fetch(url, {
|
||||
headers: authHeaders(credentials),
|
||||
method: 'POST'
|
||||
}).then((data) => data.json())
|
||||
}
|
||||
|
||||
const fetchUser = ({id, credentials}) => {
|
||||
let url = `${USER_URL}?user_id=${id}`
|
||||
return fetch(url, { headers: authHeaders(credentials) })
|
||||
|
@ -450,7 +468,9 @@ const apiService = {
|
|||
followImport,
|
||||
deleteAccount,
|
||||
changePassword,
|
||||
fetchFollowRequests
|
||||
fetchFollowRequests,
|
||||
approveUser,
|
||||
denyUser
|
||||
}
|
||||
|
||||
export default apiService
|
||||
|
|
Loading…
Reference in a new issue