diff --git a/src/modules/announcements.js b/src/modules/announcements.js index f04ba50ee2..876bcdaf27 100644 --- a/src/modules/announcements.js +++ b/src/modules/announcements.js @@ -26,7 +26,11 @@ export const mutations = { } export const getters = { - unreadAnnouncementCount (state) { + unreadAnnouncementCount (state, _getters, rootState) { + if (!rootState.users.currentUser) { + return 0 + } + return state.announcements.reduce((acc, cur) => { return (!cur.inactive && !cur.read) ? acc + 1 : acc }, 0)