2023-09-20 17:34:33 +02:00
|
|
|
import '/resources/js_vue3/assets/app.scss';
|
|
|
|
|
2023-09-27 10:44:54 +02:00
|
|
|
import Notifications from '@kyvg/vue3-notification'
|
2023-09-20 17:34:33 +02:00
|
|
|
import App from './App.vue'
|
|
|
|
import router from './router'
|
2023-09-22 13:10:42 +02:00
|
|
|
import FontAwesomeIcon from './icons'
|
2023-09-20 17:34:33 +02:00
|
|
|
|
|
|
|
const app = createApp(App)
|
|
|
|
|
2023-09-22 11:32:24 +02:00
|
|
|
// Immutable app properties provided by the laravel blade view
|
2023-09-27 10:19:48 +02:00
|
|
|
const $2fauth = {
|
|
|
|
prefix: '2fauth_',
|
2023-09-28 11:27:45 +02:00
|
|
|
config: window.appConfig,
|
2023-09-22 11:32:24 +02:00
|
|
|
version: window.appVersion,
|
|
|
|
isDemoApp: window.isDemoApp,
|
|
|
|
isTestingApp: window.isTestingApp,
|
2023-09-27 10:19:48 +02:00
|
|
|
langs: window.appLocales,
|
2023-09-22 11:32:24 +02:00
|
|
|
}
|
2023-09-27 10:19:48 +02:00
|
|
|
app.provide('2fauth', readonly($2fauth))
|
|
|
|
|
2023-09-28 11:27:45 +02:00
|
|
|
// Stores
|
2023-09-27 10:19:48 +02:00
|
|
|
const pinia = createPinia()
|
|
|
|
pinia.use(({ store }) => {
|
|
|
|
store.$2fauth = $2fauth;
|
|
|
|
});
|
|
|
|
app.use(pinia)
|
2023-09-22 11:32:24 +02:00
|
|
|
|
2023-09-28 11:27:45 +02:00
|
|
|
// Router
|
2023-09-20 17:34:33 +02:00
|
|
|
app.use(router)
|
2023-09-28 11:27:45 +02:00
|
|
|
|
|
|
|
// Localization
|
2023-09-22 12:00:16 +02:00
|
|
|
app.use(i18nVue, {
|
2023-09-22 17:14:00 +02:00
|
|
|
lang: document.documentElement.lang.substring(0, 2),
|
2023-09-22 12:00:16 +02:00
|
|
|
resolve: async lang => {
|
|
|
|
const langs = import.meta.glob('../lang/*.json');
|
2023-09-22 17:14:00 +02:00
|
|
|
if (lang.includes('php_')) {
|
|
|
|
return await langs[`../lang/${lang}.json`]();
|
|
|
|
}
|
2023-09-22 12:00:16 +02:00
|
|
|
}
|
|
|
|
})
|
2023-09-21 17:10:12 +02:00
|
|
|
app.use(Notifications)
|
2023-09-22 17:21:18 +02:00
|
|
|
|
2023-09-28 11:27:45 +02:00
|
|
|
// Components registration
|
2023-09-22 17:21:18 +02:00
|
|
|
import ResponsiveWidthWrapper from '@/layouts/ResponsiveWidthWrapper.vue'
|
|
|
|
import FormWrapper from '@/layouts/FormWrapper.vue'
|
|
|
|
import Footer from '@/layouts/Footer.vue'
|
2023-09-28 11:27:45 +02:00
|
|
|
import Modal from '@/layouts/Modal.vue'
|
2023-09-27 10:37:59 +02:00
|
|
|
import VueButton from '@/components/formElements/Button.vue'
|
|
|
|
import FieldError from '@/components/formElements/FieldError.vue'
|
|
|
|
import FormField from '@/components/formElements/FormField.vue'
|
|
|
|
import FormPasswordField from '@/components/formElements/FormPasswordField.vue'
|
2023-09-28 11:27:45 +02:00
|
|
|
// import FormSelect from './FormSelect'
|
|
|
|
// import FormSwitch from './FormSwitch'
|
|
|
|
// import FormToggle from './FormToggle'
|
|
|
|
// import FormCheckbox from './FormCheckbox'
|
2023-09-27 10:37:59 +02:00
|
|
|
import FormButtons from '@/components/formElements/FormButtons.vue'
|
2023-09-28 11:27:45 +02:00
|
|
|
// import Kicker from './Kicker'
|
|
|
|
// import SettingTabs from './SettingTabs'
|
2023-09-22 17:21:18 +02:00
|
|
|
|
2023-09-22 15:35:58 +02:00
|
|
|
app
|
2023-09-27 10:37:59 +02:00
|
|
|
.component('FontAwesomeIcon', FontAwesomeIcon)
|
|
|
|
.component('ResponsiveWidthWrapper', ResponsiveWidthWrapper)
|
|
|
|
.component('FormWrapper', FormWrapper)
|
|
|
|
.component('VueFooter', Footer)
|
2023-09-28 11:27:45 +02:00
|
|
|
.component('Modal', Modal)
|
2023-09-27 10:37:59 +02:00
|
|
|
.component('VueButton', VueButton)
|
|
|
|
.component('FieldError', FieldError)
|
|
|
|
.component('FormField', FormField)
|
|
|
|
.component('FormPasswordField', FormPasswordField)
|
|
|
|
.component('FormButtons', FormButtons)
|
2023-09-22 13:10:42 +02:00
|
|
|
|
2023-09-28 11:27:45 +02:00
|
|
|
// Global error handling
|
|
|
|
import { useNotifyStore } from '@/stores/notify'
|
|
|
|
|
|
|
|
app.config.errorHandler = (err, instance, info) => {
|
|
|
|
useNotifyStore().error(err)
|
|
|
|
}
|
|
|
|
|
2023-09-22 17:21:18 +02:00
|
|
|
// App mounting
|
2023-09-28 11:27:45 +02:00
|
|
|
app.mount('#app')
|