48 lines
1.6 KiB
JavaScript
48 lines
1.6 KiB
JavaScript
import './bootstrap';
|
|
import '../css/app.css';
|
|
|
|
import React, { lazy, useEffect } from 'react'
|
|
import { createRoot } from 'react-dom/client';
|
|
import { createInertiaApp } from '@inertiajs/react';
|
|
import { resolvePageComponent } from 'laravel-vite-plugin/inertia-helpers';
|
|
import store from '../js/Auth/store';
|
|
import { Provider } from 'react-redux';
|
|
import { BrowserRouter } from 'react-router-dom';
|
|
import Header from '@/Components/Header';
|
|
import LeftSidebar from '@/Components/LeftSidebar';
|
|
|
|
|
|
const appName = import.meta.env.VITE_APP_NAME || 'Laravel';
|
|
const Layout = lazy(() => import('./Components/Layout'))
|
|
// const Login = lazy(() => import('./pages/Login'))
|
|
// const ForgotPassword = lazy(() => import('./pages/ForgotPassword'))
|
|
// const Register = lazy(() => import('./pages/Register'))
|
|
// const Documentation = lazy(() => import('./pages/Documentation'))
|
|
|
|
createInertiaApp({
|
|
title: (title) => `${title} - ${appName}`,
|
|
resolve: (name) => resolvePageComponent(`./Pages/${name}.jsx`, import.meta.glob('./Pages/**/*.jsx')),
|
|
setup({ el, App, props }) {
|
|
const root = createRoot(el);
|
|
|
|
const LayoutWrapper = props.initialPage.component.includes('Login') ?
|
|
({ children }) => <>{children}</> :
|
|
({ children }) => <Layout>{children}</Layout>
|
|
|
|
|
|
root.render(
|
|
<Provider store={store}>
|
|
<BrowserRouter>
|
|
<LayoutWrapper>
|
|
<App {...props} />
|
|
</LayoutWrapper >
|
|
</BrowserRouter>
|
|
</Provider>
|
|
);
|
|
},
|
|
progress: {
|
|
color: '#4B5563',
|
|
},
|
|
});
|
|
|
|
// export default App
|