Release v0.1.5
This commit is contained in:
26
webui/src/module.ts
Normal file
26
webui/src/module.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { createElement, lazy } from "react";
|
||||
import type { PlatformRouteContext, PlatformWebModule } from "@govoplan/core-webui";
|
||||
import { adminReadScopes } from "@govoplan/core-webui";
|
||||
|
||||
const AdminPage = lazy(() => import("./features/admin/AdminPage"));
|
||||
|
||||
function renderAdminRoute({ settings, auth, onAuthChange }: PlatformRouteContext) {
|
||||
if (!onAuthChange) {
|
||||
throw new Error("The access admin route requires the platform auth-change callback.");
|
||||
}
|
||||
return createElement(AdminPage, { settings, auth, onAuthChange });
|
||||
}
|
||||
|
||||
export const accessModule: PlatformWebModule = {
|
||||
id: "access",
|
||||
label: "Access",
|
||||
version: "1.0.0",
|
||||
navItems: [
|
||||
{ to: "/admin", label: "Admin", iconName: "admin", anyOf: adminReadScopes, order: 900 }
|
||||
],
|
||||
routes: [
|
||||
{ path: "/admin", anyOf: adminReadScopes, order: 900, render: renderAdminRoute }
|
||||
]
|
||||
};
|
||||
|
||||
export default accessModule;
|
||||
Reference in New Issue
Block a user