From df2407c46c231bf69011b9c02ed9aefe90d54665 Mon Sep 17 00:00:00 2001 From: Bubka <858858+Bubka@users.noreply.github.com> Date: Wed, 27 Sep 2023 10:19:48 +0200 Subject: [PATCH] Replace Vue globalProperties by provide/inject at app level --- resources/js_vue3/app.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/resources/js_vue3/app.js b/resources/js_vue3/app.js index 70f6e4c0..fdb1ca25 100644 --- a/resources/js_vue3/app.js +++ b/resources/js_vue3/app.js @@ -11,15 +11,22 @@ import FontAwesomeIcon from './icons' const app = createApp(App) // Immutable app properties provided by the laravel blade view -app.config.globalProperties.$2fauth = { +const $2fauth = { + prefix: '2fauth_', config: window.appConfig, //{"proxyAuth":false,"proxyLogoutUrl":false,"subdirectory":""} version: window.appVersion, isDemoApp: window.isDemoApp, isTestingApp: window.isTestingApp, - langs: window.appLocales + langs: window.appLocales, } +app.provide('2fauth', readonly($2fauth)) + +const pinia = createPinia() +pinia.use(({ store }) => { + store.$2fauth = $2fauth; +}); +app.use(pinia) -app.use(createPinia()) app.use(router) app.use(i18nVue, { lang: document.documentElement.lang.substring(0, 2),