Skip to content
Snippets Groups Projects
Commit 04c10cf5 authored by Angelina Filippova's avatar Angelina Filippova
Browse files

Fix fetching relays, add Followed Back field

parent 2eb1d2b8
No related branches found
No related tags found
No related merge requests found
...@@ -11,23 +11,23 @@ export async function fetchRelays(authHost, token) { ...@@ -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({ return await request({
baseURL: baseName(authHost), baseURL: baseName(authHost),
url: '/api/pleroma/admin/relay', url: '/api/pleroma/admin/relay',
method: 'post', method: 'post',
headers: authHeaders(token), 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({ return await request({
baseURL: baseName(authHost), baseURL: baseName(authHost),
url: '/api/pleroma/admin/relay', url: '/api/pleroma/admin/relay',
method: 'delete', method: 'delete',
headers: authHeaders(token), headers: authHeaders(token),
data: { relay_url: `https://${relay}` } data: { relay_url }
}) })
} }
......
...@@ -406,6 +406,7 @@ export default { ...@@ -406,6 +406,7 @@ export default {
relays: 'Relays', relays: 'Relays',
follow: 'Follow', follow: 'Follow',
followRelay: 'Follow new relay', followRelay: 'Follow new relay',
followedBack: 'Followed Back',
instanceUrl: 'Instance URL', instanceUrl: 'Instance URL',
success: 'Settings changed successfully!', success: 'Settings changed successfully!',
description: 'Description', description: 'Description',
......
...@@ -23,9 +23,8 @@ const relays = { ...@@ -23,9 +23,8 @@ const relays = {
async FetchRelays({ commit, getters }) { async FetchRelays({ commit, getters }) {
commit('SET_LOADING', true) commit('SET_LOADING', true)
const response = await fetchRelays(getters.authHost, getters.token) const { data } = await fetchRelays(getters.authHost, getters.token)
commit('SET_RELAYS', data.relays)
commit('SET_RELAYS', response.data.relays)
commit('SET_LOADING', false) commit('SET_LOADING', false)
}, },
async AddRelay({ commit, dispatch, getters }, relay) { async AddRelay({ commit, dispatch, getters }, relay) {
......
...@@ -4,16 +4,25 @@ ...@@ -4,16 +4,25 @@
<el-input v-model="newRelay" :placeholder="$t('settings.followRelay')" class="follow-relay" @keyup.enter.native="followRelay"/> <el-input v-model="newRelay" :placeholder="$t('settings.followRelay')" class="follow-relay" @keyup.enter.native="followRelay"/>
<el-button type="primary" @click.native="followRelay">{{ $t('settings.follow') }}</el-button> <el-button type="primary" @click.native="followRelay">{{ $t('settings.follow') }}</el-button>
</div> </div>
<el-table :data="relaysTable"> <el-table :data="relays">
<el-table-column <el-table-column
:label="$t('settings.instanceUrl')" :label="$t('settings.instanceUrl')"
prop="instance"/> prop="actor"/>
<el-table-column fixed="right" width="120"> <el-table-column
:label="$t('settings.followedBack')"
prop="followed_back"
width="120"
align="center">
<template slot-scope="scope">
<i :class="scope.row.followed_back ? 'el-icon-check' : 'el-icon-minus'"/>
</template>
</el-table-column>
<el-table-column :label="$t('table.actions')" fixed="right" width="120" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
type="text" type="text"
size="small" size="small"
@click.native="deleteRelay(scope.row.instance)"> @click.native="deleteRelay(scope.row.actor)">
{{ $t('table.delete') }} {{ $t('table.delete') }}
</el-button> </el-button>
</template> </template>
...@@ -34,11 +43,6 @@ export default { ...@@ -34,11 +43,6 @@ export default {
relays() { relays() {
return this.$store.state.relays.fetchedRelays return this.$store.state.relays.fetchedRelays
}, },
relaysTable() {
return this.relays.map(relay => {
return { instance: relay }
})
},
loading() { loading() {
return this.$store.state.relays.loading return this.$store.state.relays.loading
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment