Move announcements module to store
This commit is contained in:
parent
e3ca5b0a32
commit
f9254e5fb7
13 changed files with 160 additions and 153 deletions
|
|
@ -2,6 +2,7 @@ import { mapState } from 'vuex'
|
|||
import AnnouncementEditor from '../announcement_editor/announcement_editor.vue'
|
||||
import RichContent from '../rich_content/rich_content.jsx'
|
||||
import localeService from '../../services/locale/locale.service.js'
|
||||
import { useAnnouncementsStore } from '../../stores/announcements'
|
||||
|
||||
const Announcement = {
|
||||
components: {
|
||||
|
|
@ -67,11 +68,11 @@ const Announcement = {
|
|||
methods: {
|
||||
markAsRead () {
|
||||
if (!this.isRead) {
|
||||
return this.$store.dispatch('markAnnouncementAsRead', this.announcement.id)
|
||||
return useAnnouncementsStore().markAnnouncementAsRead(this.announcement.id)
|
||||
}
|
||||
},
|
||||
deleteAnnouncement () {
|
||||
return this.$store.dispatch('deleteAnnouncement', this.announcement.id)
|
||||
return useAnnouncementsStore().deleteAnnouncement(this.announcement.id)
|
||||
},
|
||||
formatTimeOrDate (time, locale) {
|
||||
const d = new Date(time)
|
||||
|
|
@ -85,7 +86,7 @@ const Announcement = {
|
|||
this.editing = true
|
||||
},
|
||||
submitEdit () {
|
||||
this.$store.dispatch('editAnnouncement', {
|
||||
useAnnouncementsStore().editAnnouncement({
|
||||
id: this.announcement.id,
|
||||
...this.editedAnnouncement
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue