mirror of https://github.com/nocodb/nocodb
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.
29 lines
587 B
29 lines
587 B
2 years ago
|
import { defineNuxtPlugin, useApi, useGlobal } from '#imports'
|
||
2 years ago
|
|
||
2 years ago
|
/**
|
||
2 years ago
|
* Initialize global state and watches for changes
|
||
2 years ago
|
*
|
||
|
* @example
|
||
|
* ```js
|
||
|
* import { useNuxtApp } from '#app'
|
||
|
*
|
||
|
* const { $state } = useNuxtApp()
|
||
|
*
|
||
|
* console.log($state.lang.value) // 'en'
|
||
|
* ```
|
||
|
*/
|
||
2 years ago
|
export default defineNuxtPlugin(async (nuxtApp) => {
|
||
2 years ago
|
const state = useGlobal()
|
||
|
|
||
2 years ago
|
const { api } = useApi()
|
||
2 years ago
|
|
||
2 years ago
|
/** set i18n locale to stored language */
|
||
2 years ago
|
nuxtApp.vueApp.i18n.locale.value = state.lang.value
|
||
2 years ago
|
|
||
2 years ago
|
try {
|
||
2 years ago
|
state.appInfo.value = await api.utils.appInfo()
|
||
2 years ago
|
} catch (e) {
|
||
|
console.error(e)
|
||
|
}
|
||
2 years ago
|
})
|