多维表格
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

15 lines
602 B

import { createGlobalState, usePreferredDark, usePreferredLanguages, useStorage } from '@vueuse/core'
import type { GlobalState } from '~/lib/types'
const storageKey = 'nocodb-gui-v2'
/**
* Global State is injected by state plugin, so manual initialization is unnecessary and should be avoided
*/
export const useGlobalState = () => {
const preferredLanguages = $(usePreferredLanguages())
const darkMode = $(usePreferredDark())
return createGlobalState(() =>
useStorage<GlobalState>(storageKey, { token: undefined, user: undefined, lang: preferredLanguages[0] || 'en', darkMode }),
)
}