Files
SkinbaseNova/resources/js/admin.jsx
2026-06-09 13:16:01 +02:00

31 lines
709 B
JavaScript

import { mountInertiaRoot } from './bootstrap'
import React from 'react'
import { createInertiaApp } from '@inertiajs/react'
const pages = import.meta.glob([
'./Pages/Admin/**/*.jsx',
'./Pages/Moderation/**/*.jsx',
'!./Pages/Admin/**/__tests__/**',
'!./Pages/Admin/**/*.test.jsx',
'!./Pages/Moderation/**/__tests__/**',
'!./Pages/Moderation/**/*.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)
},
})