diff --git a/web/package.json b/web/package.json index 114191e1..ad7c09f6 100644 --- a/web/package.json +++ b/web/package.json @@ -27,6 +27,7 @@ "moment": "^2.29.4", "nanoid": "^5.0.7", "node-forge": "^1.3.1", + "pinia": "^2.1.7", "qrcode": "^1.5.3", "vue": "^3.4.15", "vue-router": "^4.2.5", diff --git a/web/src/management/api/base.js b/web/src/management/api/base.js index 45687330..1268f8bc 100644 --- a/web/src/management/api/base.js +++ b/web/src/management/api/base.js @@ -1,7 +1,7 @@ import axios from 'axios' -import store from '@/management/store/index' import router from '@/management/router/index' import { get as _get } from 'lodash-es' +import { useUserStore } from '../stores/user' export const CODE_MAP = { SUCCESS: 200, @@ -36,8 +36,9 @@ instance.interceptors.response.use( ) instance.interceptors.request.use((config) => { - const hasLogined = _get(store, 'state.user.hasLogined') - const token = _get(store, 'state.user.userInfo.token') + const userStore = useUserStore() + const hasLogined = _get(userStore, 'hasLogined') + const token = _get(userStore, 'userInfo.token') if (hasLogined && token) { if (!config.headers) { config.headers = {} diff --git a/web/src/management/main.js b/web/src/management/main.js index 56af3ac3..081784ef 100644 --- a/web/src/management/main.js +++ b/web/src/management/main.js @@ -1,14 +1,17 @@ import { createApp } from 'vue' import store from './store' +import { createPinia } from 'pinia' import plainText from './directive/plainText' import safeHtml from './directive/safeHtml' import App from './App.vue' import router from './router' +const pinia = createPinia() const app = createApp(App) app.use(store) +app.use(pinia) app.use(router) app.use(plainText) diff --git a/web/src/management/pages/list/components/MemberSelect.vue b/web/src/management/pages/list/components/MemberSelect.vue index e36437cd..9bb83ad2 100644 --- a/web/src/management/pages/list/components/MemberSelect.vue +++ b/web/src/management/pages/list/components/MemberSelect.vue @@ -23,7 +23,6 @@ diff --git a/web/src/management/pages/login/LoginPage.vue b/web/src/management/pages/login/LoginPage.vue index d502cf84..6564c9bf 100644 --- a/web/src/management/pages/login/LoginPage.vue +++ b/web/src/management/pages/login/LoginPage.vue @@ -57,7 +57,6 @@