Browse Source

fix: plugin export statement correction

pull/6631/head
Pranav C 1 year ago
parent
commit
78a1f702ba
  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()
}
const i18nPlugin = defineNuxtPlugin(async (nuxtApp) => {
const i18nPlugin = async (nuxtApp) => {
globalI18n = await createI18nPlugin()
nuxtApp.vueApp.i18n = 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 default defaultExport

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

@ -1,12 +1,12 @@
import { defineNuxtPlugin, isEeUI, useApi } from '#imports'
const apiPlugin = defineNuxtPlugin((nuxtApp) => {
const apiPlugin = (nuxtApp) => {
/** injects a global api instance */
nuxtApp.provide('api', useApi().api)
})
const defaultExport = isEeUI ? defineNuxtPlugin(async () => {}) : 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'
* ```
*/
const statePlugin = defineNuxtPlugin(async () => {
const statePlugin = async (_nuxtApp) => {
const state = useGlobal()
const { api } = useApi({ useGlobalInstance: true })
@ -34,10 +34,10 @@ const statePlugin = defineNuxtPlugin(async () => {
} catch (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 default defaultExport

Loading…
Cancel
Save