Browse Source

chore/gui-v2-user-management-added-early-return-if-state-set-in-useGlobalState

pull/2854/head
Muhammed Mustafa 2 years ago
parent
commit
8ad5e09e89
  1. 9
      packages/nc-gui-v2/composables/useGlobalState/index.ts

9
packages/nc-gui-v2/composables/useGlobalState/index.ts

@ -24,6 +24,15 @@ const storageKey = 'nocodb-gui-v2'
* ``` * ```
*/ */
export const useGlobalState = (): GlobalState => { export const useGlobalState = (): GlobalState => {
const { $state } = useNuxtApp()
if ($state) {
console.warn(
'[useGlobalState] Global state is injected by state plugin. Manual initialization is unnecessary and should be avoided.',
)
return $state
}
/** get the preferred languages of a user, according to browser settings */ /** get the preferred languages of a user, according to browser settings */
const preferredLanguages = $(usePreferredLanguages()) const preferredLanguages = $(usePreferredLanguages())
/** todo: reimplement; get the preferred dark mode setting, according to browser settings */ /** todo: reimplement; get the preferred dark mode setting, according to browser settings */

Loading…
Cancel
Save