forked from AkkomaGang/admin-fe
Show current instance's statuses
This commit is contained in:
parent
d611c7d0e5
commit
566d0fef5f
2 changed files with 26 additions and 15 deletions
|
@ -50,23 +50,33 @@ const status = {
|
||||||
},
|
},
|
||||||
async FetchStatuses({ commit, getters }, { godmode, localOnly }) {
|
async FetchStatuses({ commit, getters }, { godmode, localOnly }) {
|
||||||
commit('SET_LOADING', true)
|
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)
|
commit('SET_LOADING', false)
|
||||||
},
|
},
|
||||||
async FetchStatusesByInstance({ commit, getters, state }) {
|
async FetchStatusesByInstance({ commit, getters, state, rootState }) {
|
||||||
commit('SET_LOADING', true)
|
commit('SET_LOADING', true)
|
||||||
const statuses = state.statusesByInstance.selectedInstance === ''
|
if (state.statusesByInstance.selectedInstance === '') {
|
||||||
? { data: [] }
|
commit('SET_STATUSES_BY_INSTANCE', [])
|
||||||
: await fetchStatusesByInstance(
|
} else {
|
||||||
{
|
const statuses = state.statusesByInstance.selectedInstance === rootState.user.authHost
|
||||||
instance: state.statusesByInstance.selectedInstance,
|
? await fetchStatuses(
|
||||||
authHost: getters.authHost,
|
{
|
||||||
token: getters.token,
|
godmode: false,
|
||||||
pageSize: state.statusesByInstance.pageSize,
|
localOnly: false,
|
||||||
page: state.statusesByInstance.page
|
authHost: getters.authHost,
|
||||||
})
|
token: getters.token
|
||||||
|
})
|
||||||
commit('SET_STATUSES_BY_INSTANCE', statuses.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)
|
||||||
|
}
|
||||||
commit('SET_LOADING', false)
|
commit('SET_LOADING', false)
|
||||||
},
|
},
|
||||||
async FetchStatusesPageByInstance({ commit, getters, state }) {
|
async FetchStatusesPageByInstance({ commit, getters, state }) {
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
:selected-users="selectedUsers"
|
:selected-users="selectedUsers"
|
||||||
@apply-action="clearSelection"/>
|
@apply-action="clearSelection"/>
|
||||||
</div>
|
</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">
|
<div v-for="status in statuses" :key="status.id" class="status-container">
|
||||||
<status
|
<status
|
||||||
:status="status"
|
:status="status"
|
||||||
|
@ -52,7 +53,7 @@ export default {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
instances() {
|
instances() {
|
||||||
return ['Local statuses', ...this.$store.state.peers.fetchedPeers]
|
return [this.$store.state.user.authHost, ...this.$store.state.peers.fetchedPeers]
|
||||||
},
|
},
|
||||||
isDesktop() {
|
isDesktop() {
|
||||||
return this.$store.state.app.device === 'desktop'
|
return this.$store.state.app.device === 'desktop'
|
||||||
|
|
Loading…
Reference in a new issue