Port away from Vue2 Vue.set()

This commit is contained in:
Tusooa Zhu 2022-04-29 20:56:54 -04:00 committed by tusooa
parent 5f633bbfa3
commit dd5cc08a3e
No known key found for this signature in database
GPG Key ID: 7B467EDE43A08224

View File

@ -1,5 +1,3 @@
import { set } from 'vue'
const FETCH_ANNOUNCEMENT_INTERVAL_MS = 1000 * 60 * 5 const FETCH_ANNOUNCEMENT_INTERVAL_MS = 1000 * 60 * 5
export const defaultState = { export const defaultState = {
@ -9,7 +7,7 @@ export const defaultState = {
export const mutations = { export const mutations = {
setAnnouncements (state, announcements) { setAnnouncements (state, announcements) {
set(state, 'announcements', announcements) state.announcements = announcements
}, },
setAnnouncementRead (state, { id, read }) { setAnnouncementRead (state, { id, read }) {
const index = state.announcements.findIndex(a => a.id === id) const index = state.announcements.findIndex(a => a.id === id)
@ -18,10 +16,10 @@ export const mutations = {
return return
} }
set(state.announcements[index], 'read', read) state.announcements[index].read = read
}, },
setFetchAnnouncementsTimer (state, timer) { setFetchAnnouncementsTimer (state, timer) {
set(state, 'fetchAnnouncementsTimer', announcements) state.fetchAnnouncementsTimer = timer
} }
} }