diff --git a/src/main.ts b/src/main.ts index c97fa3b809456298fe0d0dbb0b7c87658d0b796a..ebb6e70a5e1417929e26c08099b606ce0f6347c2 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,19 +1,14 @@ -import './assets/main.css' - -import { createApp } from 'vue' -import { createPinia } from 'pinia' -import piniaPersist from 'pinia-plugin-persist'; - -import App from './App.vue' -import router from './router' +import { createApp } from 'vue'; +import { createPinia } from 'pinia'; +import App from './App.vue'; +import router from './router'; import 'bootstrap/dist/css/bootstrap.min.css'; import 'bootstrap'; const app = createApp(App); const pinia = createPinia(); -pinia.use(piniaPersist); -app.use(pinia) -app.use(router) -app.mount('#app') +app.use(pinia); +app.use(router); +app.mount('#app'); diff --git a/src/router/index.ts b/src/router/index.ts index 53e86ecf503df751299d71817ca93f147087495b..7620b659e79744d9cd791b358ca5fd219e6cc08c 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -203,7 +203,7 @@ const router = createRouter({ router.beforeEach((to, from, next) => { const requiresAuth = to.matched.some(record => record.meta.requiresAuth); const requiresAdmin = to.matched.some(record => record.meta.requiresAdmin); - let user = useUserInfoStore(); + const user= useUserInfoStore(); const userRole = user.role; const isAuthenticated = user.isLoggedIn; diff --git a/src/stores/ConfigurationStore.ts b/src/stores/ConfigurationStore.ts index fb9e0dd0d13fecdf719f8bc68970fe793b465027..951538aeed7c0153539c46042e4e82a5099c8245 100644 --- a/src/stores/ConfigurationStore.ts +++ b/src/stores/ConfigurationStore.ts @@ -3,7 +3,7 @@ export const useConfigurationStore = defineStore('ConfigurationStore', { state: () => ({ commitment: '', experience: '', - challenges: [] + challenges: [] as Array<string>, }), actions: { setCommitment(commitment: string) { @@ -28,11 +28,9 @@ export const useConfigurationStore = defineStore('ConfigurationStore', { getExperience(): string { return this.experience }, - getChallenges(): string { + getChallenges(): Array<string> { return this.challenges } }, - persist: { - enabled: true, - } + }); diff --git a/src/stores/UserStore.ts b/src/stores/UserStore.ts index 5622d43f2392f7194e8d386cdce96ab4ba5930cf..4d5fbd67b4fb90a6d00195744b2522451b95837a 100644 --- a/src/stores/UserStore.ts +++ b/src/stores/UserStore.ts @@ -2,7 +2,6 @@ import { OpenAPI } from '@/api'; import Cookies from 'js-cookie'; import { defineStore } from 'pinia'; - const cookiesStorage: Storage = { setItem(key, state) { return Cookies.set(key, state, { expires: 3 }); @@ -88,8 +87,4 @@ export const useUserInfoStore = defineStore('UserInfoStore', { return this.accessToken !== ''; }, }, - persist: { - enabled: true, - strategies: [{ key: 'userInfo', storage: cookiesStorage }] - }, }); \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 5304731b8d26326f23e647245010b28216f91dac..90465d0f61a8a55de2be4e17f31c5c343c2fceaa 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,6 +12,8 @@ } ], "compilerOptions": { - "module": "NodeNext" + "module": "NodeNext", + "types" : ["pinia-plugin-persist"], + "typeRoots": ["./node_modules/@types", "./node_modules/pinia-plugin-persist/dist"] } }