Show current instance's statuses

This commit is contained in:
Angelina Filippova 2020-02-28 23:42:16 +03:00
parent d611c7d0e5
commit 566d0fef5f
2 changed files with 26 additions and 15 deletions

View file

@ -50,23 +50,33 @@ const status = {
},
async FetchStatuses({ commit, getters }, { godmode, localOnly }) {
commit('SET_LOADING', true)
await fetchStatuses({ godmode, localOnly, authHost: getters.authHost, token: getters.token })
const statuses = await fetchStatuses({ godmode, localOnly, authHost: getters.authHost, token: getters.token })
commit('SET_STATUSES_BY_INSTANCE', statuses.data)
commit('SET_LOADING', false)
},
async FetchStatusesByInstance({ commit, getters, state }) {
async FetchStatusesByInstance({ commit, getters, state, rootState }) {
commit('SET_LOADING', true)
const statuses = state.statusesByInstance.selectedInstance === ''
? { data: [] }
: await fetchStatusesByInstance(
{
instance: state.statusesByInstance.selectedInstance,
authHost: getters.authHost,
token: getters.token,
pageSize: state.statusesByInstance.pageSize,
page: state.statusesByInstance.page
})
commit('SET_STATUSES_BY_INSTANCE', statuses.data)
if (state.statusesByInstance.selectedInstance === '') {
commit('SET_STATUSES_BY_INSTANCE', [])
} else {
const statuses = state.statusesByInstance.selectedInstance === rootState.user.authHost
? await fetchStatuses(
{
godmode: false,
localOnly: false,
authHost: getters.authHost,
token: getters.token
})
: await fetchStatusesByInstance(
{
instance: state.statusesByInstance.selectedInstance,
authHost: getters.authHost,
token: getters.token,
pageSize: state.statusesByInstance.pageSize,
page: state.statusesByInstance.page
})
commit('SET_STATUSES_BY_INSTANCE', statuses.data)
}
commit('SET_LOADING', false)
},
async FetchStatusesPageByInstance({ commit, getters, state }) {

View file

@ -22,6 +22,7 @@
:selected-users="selectedUsers"
@apply-action="clearSelection"/>
</div>
<p v-if="statuses.length === 0" class="no-statuses">{{ $t('userProfile.noStatuses') }}</p>
<div v-for="status in statuses" :key="status.id" class="status-container">
<status
:status="status"
@ -52,7 +53,7 @@ export default {
},
computed: {
instances() {
return ['Local statuses', ...this.$store.state.peers.fetchedPeers]
return [this.$store.state.user.authHost, ...this.$store.state.peers.fetchedPeers]
},
isDesktop() {
return this.$store.state.app.device === 'desktop'