mirror of https://github.com/qortal/qortal-ui
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
485 B
23 lines
485 B
import {store} from './store.js' |
|
import {saveStateToLocalStorage} from './localStorageHelpers.js' |
|
|
|
const keys = [ |
|
'config', |
|
'user' |
|
] |
|
|
|
const oldReducers = {} |
|
|
|
const oldState = store.getState() |
|
for (const key of keys) { |
|
oldReducers[key] = oldState[key] |
|
} |
|
|
|
store.subscribe(() => { |
|
const newState = store.getState() |
|
keys.forEach(key => { |
|
if (newState[key] !== oldState[key]) { |
|
saveStateToLocalStorage(key, store.getState()[key]) |
|
} |
|
}) |
|
})
|
|
|