Replace fetch with request

This commit is contained in:
Angelina Filippova 2020-09-17 03:50:43 +03:00
parent 7f59ccb050
commit b1c22da958
2 changed files with 8 additions and 9 deletions

View file

@ -39,14 +39,13 @@ export async function getInstanceDocument(name, authHost, token) {
} }
export async function updateInstanceDocument(name, formData, authHost, token) { export async function updateInstanceDocument(name, formData, authHost, token) {
const url = baseName(authHost) + `/api/pleroma/admin/instance_document/${name}` return await request({
baseURL: baseName(authHost),
return fetch(url, { url: `/api/pleroma/admin/instance_document/${name}`,
body: formData, method: 'patch',
method: 'PATCH', data: formData,
headers: authHeaders(token) headers: { ...authHeaders(token), 'Content-Type': 'multipart/form-data' }
}) })
.then((data) => data.json())
} }
export async function updateSettings(configs, authHost, token) { export async function updateSettings(configs, authHost, token) {

View file

@ -166,8 +166,8 @@ export default {
return _.get(this.settings.settings, [':pleroma', ':welcome']) || {} return _.get(this.settings.settings, [':pleroma', ':welcome']) || {}
} }
}, },
mounted() { async mounted() {
this.$store.dispatch('FetchInstanceDocument', 'instance-panel') await this.$store.dispatch('FetchInstanceDocument', 'instance-panel')
}, },
methods: { methods: {
handleEditorUpdate(content) { handleEditorUpdate(content) {