50 lines
1.6 KiB
TypeScript
50 lines
1.6 KiB
TypeScript
import { createInertiaApp } from '@inertiajs/vue3';
|
|
import { initializeTheme } from '@/composables/useAppearance';
|
|
import AppLayout from '@/layouts/AppLayout.vue';
|
|
import AuthLayout from '@/layouts/AuthLayout.vue';
|
|
import SettingsLayout from '@/layouts/settings/Layout.vue';
|
|
import { initializeFlashToast } from '@/lib/flashToast';
|
|
import { configureEcho } from '@laravel/echo-vue';
|
|
|
|
configureEcho({
|
|
broadcaster: 'reverb',
|
|
key: import.meta.env.VITE_REVERB_APP_KEY || 'mock-key',
|
|
wsHost: import.meta.env.VITE_REVERB_HOST || 'localhost',
|
|
wsPort: import.meta.env.VITE_REVERB_PORT
|
|
? Number(import.meta.env.VITE_REVERB_PORT)
|
|
: 8080,
|
|
wssPort: import.meta.env.VITE_REVERB_PORT
|
|
? Number(import.meta.env.VITE_REVERB_PORT)
|
|
: 8080,
|
|
forceTLS: false,
|
|
enabledTransports: ['ws', 'wss'],
|
|
});
|
|
(window as any).echoConfigured = true;
|
|
|
|
const appName = import.meta.env.VITE_APP_NAME || 'Laravel';
|
|
|
|
createInertiaApp({
|
|
title: (title) => (title ? `${title} - ${appName}` : appName),
|
|
layout: (name) => {
|
|
switch (true) {
|
|
case name === 'Welcome':
|
|
return null;
|
|
case name.startsWith('auth/'):
|
|
return AuthLayout;
|
|
case name.startsWith('settings/'):
|
|
return [AppLayout, SettingsLayout];
|
|
default:
|
|
return AppLayout;
|
|
}
|
|
},
|
|
progress: {
|
|
color: '#4B5563',
|
|
},
|
|
});
|
|
|
|
// This will set light / dark mode on page load...
|
|
initializeTheme();
|
|
|
|
// This will listen for flash toast data from the server...
|
|
initializeFlashToast();
|