From c2ce7009e65d96f16a1b76499f6e07b1e18ed40b Mon Sep 17 00:00:00 2001 From: march Date: Wed, 9 Aug 2023 11:43:57 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20store=E5=BE=AA=E7=8E=AF=E5=BC=95?= =?UTF-8?q?=E7=94=A8=20(#1880)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/helper.ts | 3 +++ src/store/index.ts | 4 +--- src/store/modules/app/index.ts | 2 +- src/store/modules/auth/index.ts | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) create mode 100644 src/store/helper.ts diff --git a/src/store/helper.ts b/src/store/helper.ts new file mode 100644 index 0000000000..953e453783 --- /dev/null +++ b/src/store/helper.ts @@ -0,0 +1,3 @@ +import { createPinia } from 'pinia' + +export const store = createPinia() diff --git a/src/store/index.ts b/src/store/index.ts index ad01971d21..a10acdb56a 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -1,7 +1,5 @@ import type { App } from 'vue' -import { createPinia } from 'pinia' - -export const store = createPinia() +import { store } from './helper' export function setupStore(app: App) { app.use(store) diff --git a/src/store/modules/app/index.ts b/src/store/modules/app/index.ts index 055d1f801b..89ec89b7d9 100644 --- a/src/store/modules/app/index.ts +++ b/src/store/modules/app/index.ts @@ -1,7 +1,7 @@ import { defineStore } from 'pinia' import type { AppState, Language, Theme } from './helper' import { getLocalSetting, setLocalSetting } from './helper' -import { store } from '@/store' +import { store } from '@/store/helper' export const useAppStore = defineStore('app-store', { state: (): AppState => getLocalSetting(), diff --git a/src/store/modules/auth/index.ts b/src/store/modules/auth/index.ts index 8edde9c6d2..6a4b2c78d2 100644 --- a/src/store/modules/auth/index.ts +++ b/src/store/modules/auth/index.ts @@ -1,6 +1,6 @@ import { defineStore } from 'pinia' import { getToken, removeToken, setToken } from './helper' -import { store } from '@/store' +import { store } from '@/store/helper' import { fetchSession } from '@/api' interface SessionResponse {