fix(version-check): clear localStorage if need
This commit is contained in:
10
src/main.ts
10
src/main.ts
@@ -1,13 +1,21 @@
|
||||
import { getAppEnvConfig } from '@/utils/env';
|
||||
import { VueQueryPlugin } from '@tanstack/vue-query';
|
||||
import { createApp } from 'vue';
|
||||
import { createPinia } from 'pinia';
|
||||
import persist from 'pinia-plugin-persistedstate';
|
||||
import { VueQueryPlugin } from '@tanstack/vue-query';
|
||||
|
||||
import App from './App.vue';
|
||||
import router from './router';
|
||||
|
||||
import '@/styles/reset.scss';
|
||||
|
||||
const { storageVersion } = getAppEnvConfig();
|
||||
const localStorageVersion = window.localStorage.getItem('ndm-storage-version');
|
||||
if (localStorageVersion !== storageVersion) {
|
||||
window.localStorage.clear();
|
||||
window.localStorage.setItem('ndm-storage-version', storageVersion);
|
||||
}
|
||||
|
||||
const app = createApp(App);
|
||||
|
||||
app.use(createPinia().use(persist));
|
||||
|
||||
Reference in New Issue
Block a user