Browse Source

Merge pull request #6631 from nocodb/nc-chore/plugin-export-statement

fix: Plugin export statement correction
pull/6633/head
mertmit 1 year ago committed by GitHub
parent
commit
109f79059e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      packages/nc-gui/plugins/a.i18n.ts
  2. 10
      packages/nc-gui/plugins/api.ts
  3. 10
      packages/nc-gui/plugins/state.ts

10
packages/nc-gui/plugins/a.i18n.ts

@ -43,16 +43,16 @@ export async function loadLocaleMessages(
return nextTick() return nextTick()
} }
const i18nPlugin = defineNuxtPlugin(async (nuxtApp) => { const i18nPlugin = async (nuxtApp) => {
globalI18n = await createI18nPlugin() globalI18n = await createI18nPlugin()
nuxtApp.vueApp.i18n = globalI18n nuxtApp.vueApp.i18n = globalI18n
nuxtApp.vueApp.use(globalI18n) nuxtApp.vueApp.use(globalI18n)
}) }
const defaultExport = isEeUI ? defineNuxtPlugin(async () => {}) : i18nPlugin export default defineNuxtPlugin(async function (nuxtApp) {
if (!isEeUI) return await i18nPlugin(nuxtApp)
})
export { i18nPlugin } export { i18nPlugin }
export default defaultExport

10
packages/nc-gui/plugins/api.ts

@ -1,12 +1,12 @@
import { defineNuxtPlugin, isEeUI, useApi } from '#imports' import { defineNuxtPlugin, isEeUI, useApi } from '#imports'
const apiPlugin = defineNuxtPlugin((nuxtApp) => { const apiPlugin = (nuxtApp) => {
/** injects a global api instance */ /** injects a global api instance */
nuxtApp.provide('api', useApi().api) nuxtApp.provide('api', useApi().api)
}) }
const defaultExport = isEeUI ? defineNuxtPlugin(async () => {}) : apiPlugin
export { apiPlugin } export { apiPlugin }
export default defaultExport export default defineNuxtPlugin(function (nuxtApp) {
if (!isEeUI) return apiPlugin(nuxtApp)
})

10
packages/nc-gui/plugins/state.ts

@ -13,7 +13,7 @@ import { loadLocaleMessages, setI18nLanguage } from '~/plugins/a.i18n'
* console.log($state.lang.value) // 'en' * console.log($state.lang.value) // 'en'
* ``` * ```
*/ */
const statePlugin = defineNuxtPlugin(async () => { const statePlugin = async (_nuxtApp) => {
const state = useGlobal() const state = useGlobal()
const { api } = useApi({ useGlobalInstance: true }) const { api } = useApi({ useGlobalInstance: true })
@ -34,10 +34,10 @@ const statePlugin = defineNuxtPlugin(async () => {
} catch (e) { } catch (e) {
console.error(e) console.error(e)
} }
}) }
const defaultExport = isEeUI ? defineNuxtPlugin(async () => {}) : statePlugin export default defineNuxtPlugin(async function (nuxtApp) {
if (!isEeUI) return await statePlugin(nuxtApp)
})
export { statePlugin } export { statePlugin }
export default defaultExport

Loading…
Cancel
Save