Skip to content

Commit d971b4a

Browse files
author
Guillaume Chau
committed
fix: use stoage for settings version, closes #1097
1 parent f2efbe3 commit d971b4a

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

packages/app-frontend/src/App.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@
166166
<script>
167167
import { mapState, mapGetters } from 'vuex'
168168
import { SPECIAL_TOKENS } from '@utils/util'
169+
import { get, set } from '@utils/storage'
169170
import Keyboard from '@front/mixins/keyboard'
170171
import GroupDropdown from '@front/components/GroupDropdown.vue'
171172
import { SETTINGS_VERSION_ID, SETTINGS_VERSION } from '@front/views/settings/SettingsTab.vue'
@@ -226,7 +227,7 @@ export default {
226227
{ name: 'router', label: 'History', icon: 'directions' },
227228
{ name: 'routes', label: 'Routes', icon: 'book' }
228229
],
229-
settingsVersion: parseInt(localStorage.getItem(SETTINGS_VERSION_ID))
230+
settingsVersion: parseInt(get(SETTINGS_VERSION_ID))
230231
}
231232
},
232233
@@ -253,7 +254,7 @@ export default {
253254
this.$nextTick(() => {
254255
if (value === 'settings') {
255256
this.settingsVersion = SETTINGS_VERSION
256-
localStorage.setItem(SETTINGS_VERSION_ID, SETTINGS_VERSION)
257+
set(SETTINGS_VERSION_ID, SETTINGS_VERSION)
257258
}
258259
})
259260
}

packages/app-frontend/src/views/settings/SettingsTab.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<script>
88
import GlobalPreferences from './GlobalPreferences.vue'
99
import { mapState } from 'vuex'
10+
import { get } from '@utils/storage'
1011
1112
export const SETTINGS_VERSION = 3
1213
export const SETTINGS_VERSION_ID = 'vue-devtools-settings-version'
@@ -17,7 +18,7 @@ export default {
1718
provide () {
1819
return {
1920
settingsVersion: SETTINGS_VERSION,
20-
currentSettingsVersion: parseInt(localStorage.getItem(SETTINGS_VERSION_ID)) || 0
21+
currentSettingsVersion: parseInt(get(SETTINGS_VERSION_ID)) || 0
2122
}
2223
},
2324

0 commit comments

Comments
 (0)