- vm_api.py: pure FastAPI JSON API on :8098 with CORS - vm-api.service: systemd unit for API (replaces inline HTML vm_web.py for frontend) - vm_web.py: kept intact as fallback; Apache now proxies /api/ -> :8098 - frontend/: Vite + React + TanStack Query scaffold - Apache vhost updated: DocumentRoot -> frontend/dist, /api/ proxy, SPA fallback - All original HTML pages still functional via :8099 during transition
47 lines
1.4 KiB
JavaScript
47 lines
1.4 KiB
JavaScript
"use client";
|
|
import { routerContext } from "./routerContext.js";
|
|
import { Matches } from "./Matches.js";
|
|
import { hasKeys } from "@tanstack/router-core";
|
|
import "react";
|
|
import { jsx } from "react/jsx-runtime";
|
|
//#region src/RouterProvider.tsx
|
|
/**
|
|
* Low-level provider that places the router into React context and optionally
|
|
* updates router options from props. Most apps should use `RouterProvider`.
|
|
*/
|
|
function RouterContextProvider({ router, children, ...rest }) {
|
|
if (hasKeys(rest)) router.update({
|
|
...router.options,
|
|
...rest,
|
|
context: {
|
|
...router.options.context,
|
|
...rest.context
|
|
}
|
|
});
|
|
const provider = /* @__PURE__ */ jsx(routerContext.Provider, {
|
|
value: router,
|
|
children
|
|
});
|
|
if (router.options.Wrap) return /* @__PURE__ */ jsx(router.options.Wrap, { children: provider });
|
|
return provider;
|
|
}
|
|
/**
|
|
* Renders the current match presentation and provides the router to the React
|
|
* tree via context.
|
|
*
|
|
* Accepts the same options as `createRouter` via props to update the router
|
|
* instance after creation.
|
|
*
|
|
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/createRouterFunction
|
|
*/
|
|
function RouterProvider({ router, ...rest }) {
|
|
return /* @__PURE__ */ jsx(RouterContextProvider, {
|
|
router,
|
|
...rest,
|
|
children: /* @__PURE__ */ jsx(Matches, {})
|
|
});
|
|
}
|
|
//#endregion
|
|
export { RouterContextProvider, RouterProvider };
|
|
|
|
//# sourceMappingURL=RouterProvider.js.map
|