Move editStatus module to store
This commit is contained in:
parent
27e36dbc2e
commit
3430604dda
5 changed files with 24 additions and 32 deletions
|
|
@ -2,6 +2,7 @@ import PostStatusForm from '../post_status_form/post_status_form.vue'
|
|||
import Modal from '../modal/modal.vue'
|
||||
import statusPosterService from '../../services/status_poster/status_poster.service.js'
|
||||
import get from 'lodash/get'
|
||||
import { useEditStatusStore } from '../../stores/editStatus'
|
||||
|
||||
const EditStatusModal = {
|
||||
components: {
|
||||
|
|
@ -18,13 +19,13 @@ const EditStatusModal = {
|
|||
return !!this.$store.state.users.currentUser
|
||||
},
|
||||
modalActivated () {
|
||||
return this.$store.state.editStatus.modalActivated
|
||||
return useEditStatusStore().modalActivated
|
||||
},
|
||||
isFormVisible () {
|
||||
return this.isLoggedIn && !this.resettingForm && this.modalActivated
|
||||
},
|
||||
params () {
|
||||
return this.$store.state.editStatus.params || {}
|
||||
return useEditStatusStore().params || {}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
|
@ -46,7 +47,7 @@ const EditStatusModal = {
|
|||
doEditStatus ({ status, spoilerText, sensitive, media, contentType, poll }) {
|
||||
const params = {
|
||||
store: this.$store,
|
||||
statusId: this.$store.state.editStatus.params.statusId,
|
||||
statusId: useEditStatusStore().params.statusId,
|
||||
status,
|
||||
spoilerText,
|
||||
sensitive,
|
||||
|
|
@ -67,7 +68,7 @@ const EditStatusModal = {
|
|||
})
|
||||
},
|
||||
closeModal () {
|
||||
this.$store.dispatch('closeEditStatusModal')
|
||||
useEditStatusStore().closeEditStatusModal()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import {
|
|||
faBookmark as faBookmarkReg,
|
||||
faFlag
|
||||
} from '@fortawesome/free-regular-svg-icons'
|
||||
import { useEditStatusStore } from '../../stores/editStatus'
|
||||
|
||||
library.add(
|
||||
faEllipsisH,
|
||||
|
|
@ -107,7 +108,7 @@ const ExtraButtons = {
|
|||
},
|
||||
editStatus () {
|
||||
this.$store.dispatch('fetchStatusSource', { id: this.status.id })
|
||||
.then(data => this.$store.dispatch('openEditStatusModal', {
|
||||
.then(data => useEditStatusStore().openEditStatusModal({
|
||||
statusId: this.status.id,
|
||||
subject: data.spoiler_text,
|
||||
statusText: data.text,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue