Merge branch '541' into 'develop'

Update Admin API urls in accordance with new docs

Closes #541

See merge request pleroma/pleroma-fe!796
This commit is contained in:
HJ 2019-05-16 18:30:12 +00:00
commit 23c4c0c758
1 changed files with 7 additions and 7 deletions

View File

@ -14,9 +14,9 @@ const FOLLOW_REQUESTS_URL = '/api/pleroma/friend_requests'
const APPROVE_USER_URL = '/api/pleroma/friendships/approve'
const DENY_USER_URL = '/api/pleroma/friendships/deny'
const TAG_USER_URL = '/api/pleroma/admin/users/tag'
const PERMISSION_GROUP_URL = '/api/pleroma/admin/permission_group'
const ACTIVATION_STATUS_URL = '/api/pleroma/admin/activation_status'
const ADMIN_USER_URL = '/api/pleroma/admin/user'
const PERMISSION_GROUP_URL = (screenName, right) => `/api/pleroma/admin/users/${screenName}/permission_group/${right}`
const ACTIVATION_STATUS_URL = screenName => `/api/pleroma/admin/users/${screenName}/activation_status`
const ADMIN_USERS_URL = '/api/pleroma/admin/users'
const SUGGESTIONS_URL = '/api/v1/suggestions'
const MASTODON_USER_FAVORITES_TIMELINE_URL = '/api/v1/favourites'
@ -399,7 +399,7 @@ const untagUser = ({tag, credentials, ...options}) => {
const addRight = ({right, credentials, ...user}) => {
const screenName = user.screen_name
return fetch(`${PERMISSION_GROUP_URL}/${screenName}/${right}`, {
return fetch(PERMISSION_GROUP_URL(screenName, right), {
method: 'POST',
headers: authHeaders(credentials),
body: {}
@ -409,7 +409,7 @@ const addRight = ({right, credentials, ...user}) => {
const deleteRight = ({right, credentials, ...user}) => {
const screenName = user.screen_name
return fetch(`${PERMISSION_GROUP_URL}/${screenName}/${right}`, {
return fetch(PERMISSION_GROUP_URL(screenName, right), {
method: 'DELETE',
headers: authHeaders(credentials),
body: {}
@ -425,7 +425,7 @@ const setActivationStatus = ({status, credentials, ...user}) => {
const headers = authHeaders(credentials)
headers['Content-Type'] = 'application/json'
return fetch(`${ACTIVATION_STATUS_URL}/${screenName}.json`, {
return fetch(ACTIVATION_STATUS_URL(screenName), {
method: 'PUT',
headers: headers,
body: JSON.stringify(body)
@ -436,7 +436,7 @@ const deleteUser = ({credentials, ...user}) => {
const screenName = user.screen_name
const headers = authHeaders(credentials)
return fetch(`${ADMIN_USER_URL}.json?nickname=${screenName}`, {
return fetch(`${ADMIN_USERS_URL}?nickname=${screenName}`, {
method: 'DELETE',
headers: headers
})