Fix optimistic update when unfollowing a relay

This commit is contained in:
Angelina Filippova 2020-08-19 01:02:56 +03:00
parent 7e72078f29
commit 0a146aef7f
3 changed files with 5 additions and 4 deletions

View file

@ -150,7 +150,8 @@ export default {
draft: 'Draft', draft: 'Draft',
delete: 'Delete', delete: 'Delete',
cancel: 'Cancel', cancel: 'Cancel',
confirm: 'Confirm' confirm: 'Confirm',
unfollow: 'Unfollow'
}, },
errorLog: { errorLog: {
tips: 'Please click the bug icon in the upper right corner', tips: 'Please click the bug icon in the upper right corner',

View file

@ -16,7 +16,7 @@ const relays = {
state.fetchedRelays = [...state.fetchedRelays, { actor: relay }] state.fetchedRelays = [...state.fetchedRelays, { actor: relay }]
}, },
DELETE_RELAY: (state, relay) => { DELETE_RELAY: (state, relay) => {
state.fetchedRelays = state.fetchedRelays.filter(fetchedRelay => fetchedRelay !== relay) state.fetchedRelays = state.fetchedRelays.filter(fetchedRelay => fetchedRelay.actor !== relay)
} }
}, },
actions: { actions: {

View file

@ -2,7 +2,7 @@
<div v-if="!loading" class="relays-container"> <div v-if="!loading" class="relays-container">
<div class="follow-relay-container"> <div class="follow-relay-container">
<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 @click.native="followRelay">{{ $t('settings.follow') }}</el-button>
</div> </div>
<el-table :data="relays"> <el-table :data="relays">
<el-table-column <el-table-column
@ -23,7 +23,7 @@
type="text" type="text"
size="small" size="small"
@click.native="deleteRelay(scope.row.actor)"> @click.native="deleteRelay(scope.row.actor)">
{{ $t('table.delete') }} {{ $t('table.unfollow') }}
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>