From 04c10cf5e664510026b548b8b20d68949870dfdc Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Wed, 19 Aug 2020 00:47:07 +0300 Subject: [PATCH] Fix fetching relays, add Followed Back field --- src/api/relays.js | 8 ++++---- src/lang/en.js | 1 + src/store/modules/relays.js | 5 ++--- src/views/settings/components/Relays.vue | 22 +++++++++++++--------- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/api/relays.js b/src/api/relays.js index 100ad396..7891917e 100644 --- a/src/api/relays.js +++ b/src/api/relays.js @@ -11,23 +11,23 @@ export async function fetchRelays(authHost, token) { }) } -export async function addRelay(relay, authHost, token) { +export async function addRelay(relay_url, authHost, token) { return await request({ baseURL: baseName(authHost), url: '/api/pleroma/admin/relay', method: 'post', headers: authHeaders(token), - data: { relay_url: relay } + data: { relay_url } }) } -export async function deleteRelay(relay, authHost, token) { +export async function deleteRelay(relay_url, authHost, token) { return await request({ baseURL: baseName(authHost), url: '/api/pleroma/admin/relay', method: 'delete', headers: authHeaders(token), - data: { relay_url: `https://${relay}` } + data: { relay_url } }) } diff --git a/src/lang/en.js b/src/lang/en.js index 2008aec8..6181cf32 100644 --- a/src/lang/en.js +++ b/src/lang/en.js @@ -406,6 +406,7 @@ export default { relays: 'Relays', follow: 'Follow', followRelay: 'Follow new relay', + followedBack: 'Followed Back', instanceUrl: 'Instance URL', success: 'Settings changed successfully!', description: 'Description', diff --git a/src/store/modules/relays.js b/src/store/modules/relays.js index 3a0d15cc..555886a2 100644 --- a/src/store/modules/relays.js +++ b/src/store/modules/relays.js @@ -23,9 +23,8 @@ const relays = { async FetchRelays({ commit, getters }) { commit('SET_LOADING', true) - const response = await fetchRelays(getters.authHost, getters.token) - - commit('SET_RELAYS', response.data.relays) + const { data } = await fetchRelays(getters.authHost, getters.token) + commit('SET_RELAYS', data.relays) commit('SET_LOADING', false) }, async AddRelay({ commit, dispatch, getters }, relay) { diff --git a/src/views/settings/components/Relays.vue b/src/views/settings/components/Relays.vue index eb3ac264..4ce16a56 100644 --- a/src/views/settings/components/Relays.vue +++ b/src/views/settings/components/Relays.vue @@ -4,16 +4,25 @@ {{ $t('settings.follow') }} - + - + prop="actor"/> + + + + @@ -34,11 +43,6 @@ export default { relays() { return this.$store.state.relays.fetchedRelays }, - relaysTable() { - return this.relays.map(relay => { - return { instance: relay } - }) - }, loading() { return this.$store.state.relays.loading }