mark single notifs as seen properly on server

This commit is contained in:
Shpuld Shpuldson 2020-05-02 10:52:57 +03:00
parent 406fdd8ede
commit 75519223f9
4 changed files with 22 additions and 6 deletions

View file

@ -525,6 +525,10 @@ export const mutations = {
notification.seen = true
})
},
markSingleNotificationAsSeen (state, { id }) {
const notification = find(state.notifications.data, n => n.id === id)
if (notification) notification.seen = true
},
dismissNotification (state, { id }) {
state.notifications.data = state.notifications.data.filter(n => n.id !== id)
},
@ -691,6 +695,14 @@ const statuses = {
credentials: rootState.users.currentUser.credentials
})
},
markSingleNotificationAsSeen ({ rootState, commit }, { id }) {
commit('markSingleNotificationAsSeen', { id })
apiService.markNotificationsAsSeen({
single: true,
id,
credentials: rootState.users.currentUser.credentials
})
},
dismissNotification ({ rootState, commit }, { id }) {
rootState.api.backendInteractor.dismissNotification({ id })
.then(() => commit('dismissNotification', { id }))