diff --git a/src/components/extra_buttons/extra_buttons.js b/src/components/extra_buttons/extra_buttons.js index 4f3c98e1..045d8a5f 100644 --- a/src/components/extra_buttons/extra_buttons.js +++ b/src/components/extra_buttons/extra_buttons.js @@ -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: { diff --git a/src/components/status_history_modal/status_history_modal.js b/src/components/status_history_modal/status_history_modal.js index 3941a56f..752a7c2e 100644 --- a/src/components/status_history_modal/status_history_modal.js +++ b/src/components/status_history_modal/status_history_modal.js @@ -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() } } } diff --git a/src/main.js b/src/main.js index 503467c4..8c291f54 100644 --- a/src/main.js +++ b/src/main.js @@ -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 }, diff --git a/src/modules/statusHistory.js b/src/modules/statusHistory.js deleted file mode 100644 index db3d6d4b..00000000 --- a/src/modules/statusHistory.js +++ /dev/null @@ -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 diff --git a/src/stores/statusHistory.js b/src/stores/statusHistory.js new file mode 100644 index 00000000..0d3c54c8 --- /dev/null +++ b/src/stores/statusHistory.js @@ -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 + } + } +})