forked from mirrors/akkoma-fe
ensure we sync settings whilst tab is open
This commit is contained in:
parent
80f58baa86
commit
7df49720de
4 changed files with 8872 additions and 9296 deletions
|
@ -211,7 +211,17 @@ const api = {
|
||||||
...rest
|
...rest
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
startFetchingConfig (store) {
|
||||||
|
if (store.state.fetchers.config) return
|
||||||
|
|
||||||
|
const fetcher = store.state.backendInteractor.startFetchingConfig({ store })
|
||||||
|
store.commit('addFetcher', { fetcherName: 'config', fetcher })
|
||||||
|
},
|
||||||
|
stopFetchingConfig (store) {
|
||||||
|
const fetcher = store.state.fetchers.config
|
||||||
|
if (!fetcher) return
|
||||||
|
store.commit('removeFetcher', { fetcherName: 'config', fetcher })
|
||||||
|
},
|
||||||
// Notifications
|
// Notifications
|
||||||
startFetchingNotifications (store) {
|
startFetchingNotifications (store) {
|
||||||
if (store.state.fetchers.notifications) return
|
if (store.state.fetchers.notifications) return
|
||||||
|
|
|
@ -529,6 +529,7 @@ const users = {
|
||||||
store.commit('setBackendInteractor', backendInteractorService(store.getters.getToken()))
|
store.commit('setBackendInteractor', backendInteractorService(store.getters.getToken()))
|
||||||
store.dispatch('stopFetchingNotifications')
|
store.dispatch('stopFetchingNotifications')
|
||||||
store.dispatch('stopFetchingFollowRequests')
|
store.dispatch('stopFetchingFollowRequests')
|
||||||
|
store.dispatch('stopFetchingConfig')
|
||||||
store.commit('clearNotifications')
|
store.commit('clearNotifications')
|
||||||
store.commit('resetStatuses')
|
store.commit('resetStatuses')
|
||||||
store.dispatch('setLastTimeline', 'public-timeline')
|
store.dispatch('setLastTimeline', 'public-timeline')
|
||||||
|
@ -570,8 +571,6 @@ const users = {
|
||||||
|
|
||||||
// Start fetching notifications
|
// Start fetching notifications
|
||||||
store.dispatch('startFetchingNotifications')
|
store.dispatch('startFetchingNotifications')
|
||||||
|
|
||||||
store.dispatch('startFetchingConfig')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (store.getters.mergedConfig.useStreamingApi) {
|
if (store.getters.mergedConfig.useStreamingApi) {
|
||||||
|
@ -594,6 +593,7 @@ const users = {
|
||||||
store.dispatch('getSupportedTranslationlanguages')
|
store.dispatch('getSupportedTranslationlanguages')
|
||||||
store.dispatch('getSettingsProfile')
|
store.dispatch('getSettingsProfile')
|
||||||
store.dispatch('listSettingsProfiles')
|
store.dispatch('listSettingsProfiles')
|
||||||
|
store.dispatch('startFetchingConfig')
|
||||||
|
|
||||||
// Fetch our friends
|
// Fetch our friends
|
||||||
store.rootState.api.backendInteractor.fetchFriends({ id: user.id })
|
store.rootState.api.backendInteractor.fetchFriends({ id: user.id })
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
import { promiseInterval } from '../promise_interval/promise_interval.js'
|
import { promiseInterval } from '../promise_interval/promise_interval.js'
|
||||||
|
|
||||||
const startFetching = ({ credentials, store }) => {
|
const startFetching = ({ credentials, store }) => {
|
||||||
|
console.log('startFetching: Config')
|
||||||
const boundFetchAndUpdate = () => store.dispatch('getSettingsProfile')
|
const boundFetchAndUpdate = () => store.dispatch('getSettingsProfile')
|
||||||
boundFetchAndUpdate()
|
boundFetchAndUpdate()
|
||||||
return promiseInterval(boundFetchAndUpdate, 5 * 60000)
|
return promiseInterval(boundFetchAndUpdate, 10 * 60000)
|
||||||
}
|
}
|
||||||
|
|
||||||
const configFetcher = {
|
const configFetcher = {
|
||||||
|
|
Loading…
Reference in a new issue