From f3f9fbe3027bf5284adc05387e89d904884490b2 Mon Sep 17 00:00:00 2001 From: dave Date: Fri, 1 Mar 2019 11:59:50 -0500 Subject: [PATCH] #392: clean up notification stopping section --- src/modules/statuses.js | 6 ++++++ src/modules/users.js | 4 +--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/modules/statuses.js b/src/modules/statuses.js index 028053cf..77a8ec72 100644 --- a/src/modules/statuses.js +++ b/src/modules/statuses.js @@ -401,6 +401,12 @@ const statuses = { setNotificationsSilence ({ rootState, commit }, { value }) { commit('setNotificationsSilence', { value }) }, + stopFetchingNotifications ({ rootState, commit }) { + if (rootState.statuses.notifications.fetcherId) { + window.clearInterval(rootState.statuses.notifications.fetcherId) + } + commit('setNotificationFetcher', { fetcherId: null }) + }, deleteStatus ({ rootState, commit }, status) { commit('setDeleted', { status }) apiService.deleteStatus({ id: status.id, credentials: rootState.users.currentUser.credentials }) diff --git a/src/modules/users.js b/src/modules/users.js index 84fe039b..0e1dd166 100644 --- a/src/modules/users.js +++ b/src/modules/users.js @@ -290,9 +290,7 @@ const users = { store.commit('setToken', false) store.dispatch('stopFetching', 'friends') store.commit('setBackendInteractor', backendInteractorService()) - if (store.rootState.statuses.notifications.fetcherId) { - window.clearInterval(store.rootState.statuses.notifications.fetcherId) - } + store.dispatch('stopFetchingNotifications') store.commit('resetStatuses') }, loginUser (store, accessToken) {