2021-09-07 13:28:20 +02:00
|
|
|
import '../scss/app.scss';
|
2021-10-09 17:15:15 +02:00
|
|
|
import '@mdi/font/scss/materialdesignicons.scss';
|
2021-07-30 22:56:43 +02:00
|
|
|
|
2021-09-10 16:53:40 +02:00
|
|
|
import {InertiaProgress} from '@inertiajs/progress';
|
2021-09-07 13:28:20 +02:00
|
|
|
import {createInertiaApp} from '@maicol07/inertia-mithril';
|
2021-10-08 16:38:46 +02:00
|
|
|
import $ from 'cash-dom';
|
2021-09-07 13:28:20 +02:00
|
|
|
import m from 'mithril';
|
2021-12-14 19:18:09 +01:00
|
|
|
// noinspection SpellCheckingInspection
|
2021-12-14 12:34:17 +01:00
|
|
|
import redaxios from 'redaxios';
|
2021-09-07 13:28:20 +02:00
|
|
|
|
2021-11-09 10:14:08 +01:00
|
|
|
import {__} from './utils';
|
|
|
|
|
2021-09-07 13:28:20 +02:00
|
|
|
// Variabili globali
|
2021-10-08 16:38:46 +02:00
|
|
|
window.$ = $;
|
2021-09-07 13:28:20 +02:00
|
|
|
window.m = m;
|
2021-11-09 10:14:08 +01:00
|
|
|
window.__ = __;
|
2021-09-07 13:28:20 +02:00
|
|
|
|
2021-09-10 16:53:40 +02:00
|
|
|
InertiaProgress.init();
|
|
|
|
|
2021-08-02 13:13:02 +02:00
|
|
|
// noinspection JSIgnoredPromiseFromCall
|
|
|
|
createInertiaApp({
|
2021-09-07 13:28:20 +02:00
|
|
|
title: title => `${title} - OpenSTAManager`,
|
|
|
|
resolve: async (name) => {
|
|
|
|
const split = name.split('::');
|
|
|
|
|
|
|
|
if (split.length === 1) {
|
2021-12-14 19:18:09 +01:00
|
|
|
// Load bundled page
|
|
|
|
const {default: page} = await import(`./Views/${name}.jsx`);
|
|
|
|
return page;
|
2021-09-07 13:28:20 +02:00
|
|
|
}
|
|
|
|
|
2021-12-14 19:18:09 +01:00
|
|
|
// Load page from module
|
|
|
|
const [modulePath, page] = split;
|
|
|
|
|
2021-09-07 13:28:20 +02:00
|
|
|
// noinspection JSUnresolvedVariable
|
2021-12-14 19:18:09 +01:00
|
|
|
const osmModule = await import(
|
|
|
|
/* @vite-ignore */
|
|
|
|
`${window.import_path}/vendor/${modulePath}/index.js`
|
|
|
|
);
|
|
|
|
|
|
|
|
return osmModule[page];
|
2021-09-07 13:28:20 +02:00
|
|
|
},
|
2021-10-08 12:20:07 +02:00
|
|
|
setup({
|
|
|
|
el,
|
|
|
|
app
|
|
|
|
}) {
|
2021-08-02 13:13:02 +02:00
|
|
|
m.mount(el, app);
|
2021-12-13 21:07:23 +01:00
|
|
|
import('./_material');
|
2021-09-07 13:28:20 +02:00
|
|
|
}
|
2021-08-02 13:13:02 +02:00
|
|
|
});
|
2021-12-14 12:34:17 +01:00
|
|
|
|
|
|
|
$('#logout-button').on('click', async () => {
|
|
|
|
await redaxios.post(window.route('auth.logout'));
|
|
|
|
window.location.href = window.route('auth.login');
|
|
|
|
});
|