Add api functions for modifying instance docs

This commit is contained in:
Angelina Filippova 2020-09-11 20:48:48 +03:00
parent 413e0f5b7f
commit b039968517

View file

@ -2,6 +2,15 @@ import request from '@/utils/request'
import { getToken } from '@/utils/auth'
import { baseName } from './utils'
export async function deleteInstanceDocument(name, authHost, token) {
return await request({
baseURL: baseName(authHost),
url: `/api/pleroma/admin/instance_document/${name}`,
method: 'delete',
headers: authHeaders(token)
})
}
export async function fetchDescription(authHost, token) {
return await request({
baseURL: baseName(authHost),
@ -20,6 +29,26 @@ export async function fetchSettings(authHost, token) {
})
}
export async function getInstanceDocument(name, authHost, token) {
return await request({
baseURL: baseName(authHost),
url: `/api/pleroma/admin/instance_document/${name}`,
method: 'get',
headers: authHeaders(token)
})
}
export async function updateInstanceDocument(name, formData, authHost, token) {
const url = baseName(authHost) + `/api/pleroma/admin/instance_document/${name}`
return fetch(url, {
body: formData,
method: 'patch',
headers: authHeaders(token)
})
.then((data) => data.json())
}
export async function updateSettings(configs, authHost, token) {
return await request({
baseURL: baseName(authHost),