Create action for fetching single status
This commit is contained in:
parent
cd09e09431
commit
9c06776154
2 changed files with 51 additions and 1 deletions
|
@ -1,7 +1,8 @@
|
|||
import { changeStatusScope, deleteStatus, fetchStatuses, fetchStatusesCount, fetchStatusesByInstance } from '@/api/status'
|
||||
import { changeStatusScope, deleteStatus, fetchStatus, fetchStatuses, fetchStatusesCount, fetchStatusesByInstance } from '@/api/status'
|
||||
|
||||
const status = {
|
||||
state: {
|
||||
fetchedStatus: {},
|
||||
fetchedStatuses: [],
|
||||
loading: false,
|
||||
statusesByInstance: {
|
||||
|
@ -28,6 +29,9 @@ const status = {
|
|||
CHANGE_SELECTED_INSTANCE: (state, instance) => {
|
||||
state.statusesByInstance.selectedInstance = instance
|
||||
},
|
||||
SET_STATUS: (state, status) => {
|
||||
state.fetchedStatus = status
|
||||
},
|
||||
SET_STATUSES_BY_INSTANCE: (state, statuses) => {
|
||||
state.fetchedStatuses = statuses
|
||||
},
|
||||
|
@ -68,6 +72,13 @@ const status = {
|
|||
dispatch('FetchStatusesByInstance')
|
||||
}
|
||||
},
|
||||
async FetchStatus({ commit, getters }, id) {
|
||||
commit('SET_LOADING', true)
|
||||
const status = await fetchStatus(id, getters.authHost, getters.token)
|
||||
console.log(status)
|
||||
commit('SET_STATUS', status.data)
|
||||
commit('SET_LOADING', false)
|
||||
},
|
||||
async FetchStatusesCount({ commit, getters }) {
|
||||
commit('SET_LOADING', true)
|
||||
const { data } = await fetchStatusesCount(getters.authHost, getters.token)
|
||||
|
|
39
src/views/statuses/show.vue
Normal file
39
src/views/statuses/show.vue
Normal file
|
@ -0,0 +1,39 @@
|
|||
<template>
|
||||
<main>
|
||||
{{ status }}
|
||||
<!-- <status :status="status" :account="status.account" :show-checkbox="false" :godmode="showPrivate"/> -->
|
||||
</main>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Status from '@/components/Status'
|
||||
|
||||
export default {
|
||||
name: 'UsersShow',
|
||||
components: { Status },
|
||||
data() {
|
||||
return {
|
||||
showPrivate: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
isDesktop() {
|
||||
return this.$store.state.app.device === 'desktop'
|
||||
},
|
||||
isMobile() {
|
||||
return this.$store.state.app.device === 'mobile'
|
||||
},
|
||||
isTablet() {
|
||||
return this.$store.state.app.device === 'tablet'
|
||||
},
|
||||
status() {
|
||||
return this.$store.state.status.fetchedStatus
|
||||
}
|
||||
},
|
||||
mounted: function() {
|
||||
this.$store.dispatch('NeedReboot')
|
||||
this.$store.dispatch('GetNodeInfo')
|
||||
this.$store.dispatch('FetchStatus', this.$route.params.id)
|
||||
}
|
||||
}
|
||||
</script>
|
Loading…
Reference in a new issue