Fix fetching relays, add Followed Back field
This commit is contained in:
parent
2eb1d2b840
commit
04c10cf5e6
4 changed files with 20 additions and 16 deletions
|
@ -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 }
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -4,16 +4,25 @@
|
|||
<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>
|
||||
</div>
|
||||
<el-table :data="relaysTable">
|
||||
<el-table :data="relays">
|
||||
<el-table-column
|
||||
:label="$t('settings.instanceUrl')"
|
||||
prop="instance"/>
|
||||
<el-table-column fixed="right" width="120">
|
||||
prop="actor"/>
|
||||
<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">
|
||||
<el-button
|
||||
type="text"
|
||||
size="small"
|
||||
@click.native="deleteRelay(scope.row.instance)">
|
||||
@click.native="deleteRelay(scope.row.actor)">
|
||||
{{ $t('table.delete') }}
|
||||
</el-button>
|
||||
</template>
|
||||
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue