Move statusHistory module to store
This commit is contained in:
parent
c25cfe540b
commit
872569ae8e
|
@ -17,6 +17,7 @@ import {
|
|||
faFlag
|
||||
} from '@fortawesome/free-regular-svg-icons'
|
||||
import { useEditStatusStore } from '../../stores/editStatus'
|
||||
import { useStatusHistoryStore } from '../../stores/statusHistory'
|
||||
|
||||
library.add(
|
||||
faEllipsisH,
|
||||
|
@ -123,7 +124,7 @@ const ExtraButtons = {
|
|||
const originalStatus = { ...this.status }
|
||||
const stripFieldsList = ['attachments', 'created_at', 'emojis', 'text', 'raw_html', 'nsfw', 'poll', 'summary', 'summary_raw_html']
|
||||
stripFieldsList.forEach(p => delete originalStatus[p])
|
||||
this.$store.dispatch('openStatusHistoryModal', originalStatus)
|
||||
useStatusHistoryStore().openStatusHistoryModal(originalStatus)
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { get } from 'lodash'
|
||||
import Modal from '../modal/modal.vue'
|
||||
import Status from '../status/status.vue'
|
||||
import { useStatusHistoryStore } from '../../stores/statusHistory'
|
||||
|
||||
const StatusHistoryModal = {
|
||||
components: {
|
||||
|
@ -14,10 +15,10 @@ const StatusHistoryModal = {
|
|||
},
|
||||
computed: {
|
||||
modalActivated () {
|
||||
return this.$store.state.statusHistory.modalActivated
|
||||
return useStatusHistoryStore().modalActivated
|
||||
},
|
||||
params () {
|
||||
return this.$store.state.statusHistory.params
|
||||
return useStatusHistoryStore().params
|
||||
},
|
||||
statusId () {
|
||||
return this.params.id
|
||||
|
@ -52,7 +53,7 @@ const StatusHistoryModal = {
|
|||
})
|
||||
},
|
||||
closeModal () {
|
||||
this.$store.dispatch('closeStatusHistoryModal')
|
||||
useStatusHistoryStore().closeStatusHistoryModal()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@ import authFlowModule from './modules/auth_flow.js'
|
|||
import oauthTokensModule from './modules/oauth_tokens.js'
|
||||
import reportsModule from './modules/reports.js'
|
||||
import pollsModule from './modules/polls.js'
|
||||
import statusHistoryModule from './modules/statusHistory.js'
|
||||
|
||||
import chatsModule from './modules/chats.js'
|
||||
import announcementsModule from './modules/announcements.js'
|
||||
|
@ -80,7 +79,6 @@ const persistedStateOptions = {
|
|||
oauthTokens: oauthTokensModule,
|
||||
reports: reportsModule,
|
||||
polls: pollsModule,
|
||||
statusHistory: statusHistoryModule,
|
||||
chats: chatsModule,
|
||||
announcements: announcementsModule
|
||||
},
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
const statusHistory = {
|
||||
state: {
|
||||
params: {},
|
||||
modalActivated: false
|
||||
},
|
||||
mutations: {
|
||||
openStatusHistoryModal (state, params) {
|
||||
state.params = params
|
||||
state.modalActivated = true
|
||||
},
|
||||
closeStatusHistoryModal (state) {
|
||||
state.modalActivated = false
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
openStatusHistoryModal ({ commit }, params) {
|
||||
commit('openStatusHistoryModal', params)
|
||||
},
|
||||
closeStatusHistoryModal ({ commit }) {
|
||||
commit('closeStatusHistoryModal')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default statusHistory
|
|
@ -0,0 +1,17 @@
|
|||
import { defineStore } from 'pinia'
|
||||
|
||||
export const useStatusHistoryStore = defineStore('statusHistory', {
|
||||
state: () => ({
|
||||
params: {},
|
||||
modalActivated: false
|
||||
}),
|
||||
actions: {
|
||||
openStatusHistoryModal (params) {
|
||||
this.params = params
|
||||
this.modalActivated = true
|
||||
},
|
||||
closeStatusHistoryModal () {
|
||||
this.modalActivated = false
|
||||
}
|
||||
}
|
||||
})
|
Loading…
Reference in New Issue