From b3cd4a3d1d36c440d9c9f8ed2bbfe710c3ad3f71 Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Fri, 5 Mar 2021 11:22:28 +0800 Subject: [PATCH] Use new endpoint to get list of tabs --- src/api/settings.js | 2 +- src/store/modules/settings.js | 38 +++++++---------------------------- 2 files changed, 8 insertions(+), 32 deletions(-) diff --git a/src/api/settings.js b/src/api/settings.js index 8c543a7e..c37c0931 100644 --- a/src/api/settings.js +++ b/src/api/settings.js @@ -14,7 +14,7 @@ export async function deleteInstanceDocument(name, authHost, token) { export async function fetchDescription(authHost, token) { return await request({ baseURL: baseName(authHost), - url: `/api/pleroma/admin/config/descriptions`, + url: `/api/v2/pleroma/admin/config/descriptions`, method: 'get', headers: authHeaders(token) }) diff --git a/src/store/modules/settings.js b/src/store/modules/settings.js index 22023b66..8f3c423c 100644 --- a/src/store/modules/settings.js +++ b/src/store/modules/settings.js @@ -101,38 +101,14 @@ const settings = { async FetchSettings({ commit, getters }) { commit('SET_LOADING', true) try { - const response = await fetchSettings(getters.authHost, getters.token) - const realResponse = { ...response, - tabs: [ - { label: 'ActivityPub', path: 'activity-pub' }, - { label: 'Authentication', path: 'authentication' }, - { label: 'Captcha', path: 'captcha' }, - { label: 'BBS / SSH access', path: 'esshd' }, - { label: 'Emoji', path: 'emoji' }, - { label: 'Frontend', path: 'frontend' }, - { label: 'Gopher', path: 'gopher' }, - { label: 'HTTP', path: 'http' }, - { label: 'Instance', path: 'instance' }, - { label: 'Job queue', path: 'job-queue' }, - { label: 'Link Formatter', path: 'link-formatter' }, - { label: 'Logger', path: 'logger' }, - { label: 'Mailer', path: 'mailer' }, - { label: 'Media Proxy', path: 'media-proxy' }, - { label: 'Metadata', path: 'metadata' }, - { label: 'MRF', path: 'mrf' }, - { label: 'Rate limiters', path: 'rate-limiters' }, - { label: 'Relays', path: 'relays' }, - { label: 'Web push encryption', path: 'web-push' }, - { label: 'Upload', path: 'upload' }, - { label: 'Other', path: 'other' } - ] - } - const description = await fetchDescription(getters.authHost, getters.token) - commit('SET_DESCRIPTION', description.data) - const searchObject = formSearchObject(description.data) + const settings = await fetchSettings(getters.authHost, getters.token) + commit('SET_SETTINGS', settings.data.configs) + + const { data } = await fetchDescription(getters.authHost, getters.token) + commit('SET_DESCRIPTION', data.descriptions) + const searchObject = formSearchObject(data.descriptions) commit('SET_SEARCH', searchObject) - commit('SET_SETTINGS', realResponse.data.configs) - commit('SET_TABS', realResponse.tabs) + commit('SET_TABS', data.tabs) } catch (_e) { commit('TOGGLE_TABS', true) commit('SET_LOADING', false)