49 lines
3.6 KiB
JavaScript
49 lines
3.6 KiB
JavaScript
var _a;
|
|
import { jsx } from "react/jsx-runtime";
|
|
import axios from "axios";
|
|
import _ from "lodash";
|
|
import { createRoot } from "react-dom/client";
|
|
import { createInertiaApp } from "@inertiajs/react";
|
|
import { createContext, useContext } from "react";
|
|
window._ = _;
|
|
window.axios = axios;
|
|
window.axios.defaults.headers.common["X-Requested-With"] = "XMLHttpRequest";
|
|
const RouteContext = createContext(null);
|
|
function useRoute() {
|
|
const fn = useContext(RouteContext);
|
|
if (!fn) {
|
|
throw new Error("Route function must be provided");
|
|
}
|
|
return fn;
|
|
}
|
|
async function resolvePageComponent(path, pages) {
|
|
for (const p of Array.isArray(path) ? path : [path]) {
|
|
const page = pages[p];
|
|
if (typeof page === "undefined") {
|
|
continue;
|
|
}
|
|
return typeof page === "function" ? page() : page;
|
|
}
|
|
throw new Error(`Page not found: ${path}`);
|
|
}
|
|
const appName = ((_a = window.document.getElementsByTagName("title")[0]) == null ? void 0 : _a.innerText) || "Laravel";
|
|
createInertiaApp({
|
|
title: (title) => `${title} - ${appName}`,
|
|
progress: {
|
|
color: "#4B5563"
|
|
},
|
|
resolve: (name) => resolvePageComponent(
|
|
`./Pages/${name}.tsx`,
|
|
/* @__PURE__ */ Object.assign({ "./Pages/API/Index.tsx": () => import("./assets/Index-CwIeEkIw.js"), "./Pages/API/Partials/APITokenManager.tsx": () => import("./assets/APITokenManager-iZxUx3eK.js"), "./Pages/Auth/ConfirmPassword.tsx": () => import("./assets/ConfirmPassword-ju6YtACP.js"), "./Pages/Auth/ForgotPassword.tsx": () => import("./assets/ForgotPassword-BhYnh0qc.js"), "./Pages/Auth/Login.tsx": () => import("./assets/Login-P_qEmbLO.js"), "./Pages/Auth/Register.tsx": () => import("./assets/Register-anJ95HWS.js"), "./Pages/Auth/ResetPassword.tsx": () => import("./assets/ResetPassword-DAOSACWm.js"), "./Pages/Auth/TwoFactorChallenge.tsx": () => import("./assets/TwoFactorChallenge-Tkr6HCx-.js"), "./Pages/Auth/VerifyEmail.tsx": () => import("./assets/VerifyEmail--hB-n-6S.js"), "./Pages/Dashboard.tsx": () => import("./assets/Dashboard-CkDsUhZk.js"), "./Pages/PrivacyPolicy.tsx": () => import("./assets/PrivacyPolicy-DYEevN3b.js"), "./Pages/Profile/Partials/DeleteUserForm.tsx": () => import("./assets/DeleteUserForm-Ptw0GKXr.js"), "./Pages/Profile/Partials/LogoutOtherBrowserSessionsForm.tsx": () => import("./assets/LogoutOtherBrowserSessionsForm-Bd8DyQdZ.js"), "./Pages/Profile/Partials/TwoFactorAuthenticationForm.tsx": () => import("./assets/TwoFactorAuthenticationForm-BLalZpWn.js"), "./Pages/Profile/Partials/UpdatePasswordForm.tsx": () => import("./assets/UpdatePasswordForm-B_100APE.js"), "./Pages/Profile/Partials/UpdateProfileInformationForm.tsx": () => import("./assets/UpdateProfileInformationForm-g6OOT46r.js"), "./Pages/Profile/Show.tsx": () => import("./assets/Show-DAwzGQF4.js"), "./Pages/Teams/Create.tsx": () => import("./assets/Create-Bq48ODsT.js"), "./Pages/Teams/Partials/CreateTeamForm.tsx": () => import("./assets/CreateTeamForm-CmUI_Zfp.js"), "./Pages/Teams/Partials/DeleteTeamForm.tsx": () => import("./assets/DeleteTeamForm-CDG-Mx5L.js"), "./Pages/Teams/Partials/TeamMemberManager.tsx": () => import("./assets/TeamMemberManager-vS8Og7eY.js"), "./Pages/Teams/Partials/UpdateTeamNameForm.tsx": () => import("./assets/UpdateTeamNameForm-CArH28KV.js"), "./Pages/Teams/Show.tsx": () => import("./assets/Show-C_aCmrEJ.js"), "./Pages/TermsOfService.tsx": () => import("./assets/TermsOfService-CfLQttvD.js"), "./Pages/Welcome.tsx": () => import("./assets/Welcome-Bnby2VG4.js") })
|
|
),
|
|
setup({ el, App, props }) {
|
|
const root = createRoot(el);
|
|
return root.render(
|
|
/* @__PURE__ */ jsx(RouteContext.Provider, { value: window.route, children: /* @__PURE__ */ jsx(App, { ...props }) })
|
|
);
|
|
}
|
|
});
|
|
export {
|
|
useRoute as u
|
|
};
|