init
This commit is contained in:
commit
44f31f8b9f
402 changed files with 47865 additions and 0 deletions
36
plugins/localStorage.js
Normal file
36
plugins/localStorage.js
Normal file
|
@ -0,0 +1,36 @@
|
|||
/* eslint-disable no-console */
|
||||
// ~/plugins/localStorage.js
|
||||
import createPersistedState from 'vuex-persistedstate'
|
||||
|
||||
import { isStorageAvailable } from '@/utils'
|
||||
|
||||
const { OLD_STORE_NAME, STORE_NAME = 'tornadoClassicV2' } = process.env
|
||||
|
||||
function migrate() {
|
||||
if (isStorageAvailable('localStorage') && OLD_STORE_NAME !== STORE_NAME) {
|
||||
const oldStore = localStorage[OLD_STORE_NAME]
|
||||
if (oldStore) {
|
||||
localStorage.setItem(STORE_NAME, oldStore)
|
||||
localStorage.removeItem(OLD_STORE_NAME)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default ({ store, isHMR }) => {
|
||||
if (isHMR) {
|
||||
return
|
||||
}
|
||||
|
||||
const paths = ['metamask.netId', 'application.selectedStatistic', 'application.selectedInstance']
|
||||
|
||||
if (!store.$isLoadedFromIPFS()) {
|
||||
paths.push('txHashKeeper', 'settings', 'account', 'relayer.jobs', 'encryptedNote.ui')
|
||||
}
|
||||
|
||||
migrate()
|
||||
|
||||
createPersistedState({
|
||||
key: STORE_NAME,
|
||||
paths
|
||||
})(store)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue