Skip to content

Commit 0bc880d

Browse files
committed
feat(useAnu): use official composable from vueuse for creating state
1 parent 3e76250 commit 0bc880d

File tree

2 files changed

+4
-28
lines changed

2 files changed

+4
-28
lines changed

packages/anu-vue/src/composables/useAnu.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import type { ConfigThemes, PluginOptions } from '../plugin'
2-
import { createCustomGlobalState } from '@/composables/useCustomCreateGlobalState'
32

43
function getThemeColorsCss(themes: ConfigThemes) {
54
return Object.values(themes)
@@ -14,7 +13,10 @@ export interface AnuComposableOptions {
1413
initialTheme: PluginOptions['initialTheme']
1514
}
1615

17-
export const useAnu = createCustomGlobalState((options: AnuComposableOptions) => {
16+
export const useAnu = createGlobalState((options?: AnuComposableOptions) => {
17+
if (!options)
18+
throw new Error('Anu: useAnu composable must be initialized with options first time!')
19+
1820
const themes = ref(options.themes)
1921
const activeThemeName = ref(options.initialTheme)
2022
const activeTheme = computed(() => ({

packages/anu-vue/src/composables/useCustomCreateGlobalState.ts

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)