Skip to content

Commit

Permalink
fix: store循环引用 (Chanzhaoyu#1880)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdongsheng committed Aug 9, 2023
1 parent b651ef8 commit c2ce700
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
3 changes: 3 additions & 0 deletions src/store/helper.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { createPinia } from 'pinia'

export const store = createPinia()
4 changes: 1 addition & 3 deletions src/store/index.ts
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/store/modules/app/index.ts
Original file line number Diff line number Diff line change
@@ -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(),
Expand Down
2 changes: 1 addition & 1 deletion src/store/modules/auth/index.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down

0 comments on commit c2ce700

Please sign in to comment.