mirror of
https://akkoma.dev/AkkomaGang/akkoma-fe.git
synced 2024-11-09 10:13:42 +00:00
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
|
||||
})
|
||||
},
|
||||
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
|
||||
startFetchingNotifications (store) {
|
||||
if (store.state.fetchers.notifications) return
|
||||
|
|
|
@ -529,6 +529,7 @@ const users = {
|
|||
store.commit('setBackendInteractor', backendInteractorService(store.getters.getToken()))
|
||||
store.dispatch('stopFetchingNotifications')
|
||||
store.dispatch('stopFetchingFollowRequests')
|
||||
store.dispatch('stopFetchingConfig')
|
||||
store.commit('clearNotifications')
|
||||
store.commit('resetStatuses')
|
||||
store.dispatch('setLastTimeline', 'public-timeline')
|
||||
|
@ -570,8 +571,6 @@ const users = {
|
|||
|
||||
// Start fetching notifications
|
||||
store.dispatch('startFetchingNotifications')
|
||||
|
||||
store.dispatch('startFetchingConfig')
|
||||
}
|
||||
|
||||
if (store.getters.mergedConfig.useStreamingApi) {
|
||||
|
@ -594,6 +593,7 @@ const users = {
|
|||
store.dispatch('getSupportedTranslationlanguages')
|
||||
store.dispatch('getSettingsProfile')
|
||||
store.dispatch('listSettingsProfiles')
|
||||
store.dispatch('startFetchingConfig')
|
||||
|
||||
// Fetch our friends
|
||||
store.rootState.api.backendInteractor.fetchFriends({ id: user.id })
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import { promiseInterval } from '../promise_interval/promise_interval.js'
|
||||
|
||||
const startFetching = ({ credentials, store }) => {
|
||||
console.log('startFetching: Config')
|
||||
const boundFetchAndUpdate = () => store.dispatch('getSettingsProfile')
|
||||
boundFetchAndUpdate()
|
||||
return promiseInterval(boundFetchAndUpdate, 5 * 60000)
|
||||
return promiseInterval(boundFetchAndUpdate, 10 * 60000)
|
||||
}
|
||||
|
||||
const configFetcher = {
|
||||
|
|
Loading…
Reference in a new issue