Wire admin studio SSR and search infrastructure
This commit is contained in:
27
resources/js/admin.jsx
Normal file
27
resources/js/admin.jsx
Normal file
@@ -0,0 +1,27 @@
|
||||
import { mountInertiaRoot } from './bootstrap'
|
||||
import React from 'react'
|
||||
import { createInertiaApp } from '@inertiajs/react'
|
||||
|
||||
const pages = import.meta.glob([
|
||||
'./Pages/Admin/**/*.jsx',
|
||||
'!./Pages/Admin/**/__tests__/**',
|
||||
'!./Pages/Admin/**/*.test.jsx',
|
||||
])
|
||||
|
||||
function resolvePage(name) {
|
||||
const path = `./Pages/${name}.jsx`
|
||||
const page = pages[path]
|
||||
|
||||
if (!page) {
|
||||
throw new Error(`Unknown admin page: ${path}`)
|
||||
}
|
||||
|
||||
return page().then((module) => module.default)
|
||||
}
|
||||
|
||||
createInertiaApp({
|
||||
resolve: resolvePage,
|
||||
setup({ el, App, props }) {
|
||||
mountInertiaRoot(el, App, props)
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user