mirror of
https://github.com/mmjee/Piped-Material.git
synced 2024-12-06 19:26:36 +01:00
Cross-tab syncing
This commit is contained in:
@@ -122,6 +122,15 @@ const AuthenticationStore = {
|
||||
}
|
||||
}
|
||||
|
||||
export {
|
||||
AuthenticationStore
|
||||
function initializeAuthEvents (store) {
|
||||
window.addEventListener('storage', (storageEv) => {
|
||||
if (storageEv.key === 'AUTH') {
|
||||
store.commit('auth/replaceAuth', JSON.parse(storageEv.newValue))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export {
|
||||
AuthenticationStore,
|
||||
initializeAuthEvents
|
||||
}
|
||||
|
||||
+5
-2
@@ -1,8 +1,8 @@
|
||||
import Vue from 'vue'
|
||||
import Vuex from 'vuex'
|
||||
|
||||
import { PrefsStore } from '@/store/prefs-store'
|
||||
import { AuthenticationStore } from '@/store/authentication-store'
|
||||
import { PrefsStore, initializePrefEvents } from '@/store/prefs-store'
|
||||
import { AuthenticationStore, initializeAuthEvents } from '@/store/authentication-store'
|
||||
|
||||
Vue.use(Vuex)
|
||||
|
||||
@@ -13,4 +13,7 @@ const store = new Vuex.Store({
|
||||
}
|
||||
})
|
||||
|
||||
initializePrefEvents(store)
|
||||
initializeAuthEvents(store)
|
||||
|
||||
export default store
|
||||
|
||||
@@ -77,6 +77,15 @@ const PrefsStore = {
|
||||
}
|
||||
}
|
||||
|
||||
export {
|
||||
PrefsStore
|
||||
function initializePrefEvents (store) {
|
||||
window.addEventListener('storage', (storageEv) => {
|
||||
if (storageEv.key === 'PREFERENCES') {
|
||||
store.commit('prefs/replacePrefs', JSON.parse(storageEv.newValue))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export {
|
||||
PrefsStore,
|
||||
initializePrefEvents
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user