Use new routing conventions for event routes (#903)
This commit is contained in:
parent
5dde8ee523
commit
88ae607148
3 changed files with 30 additions and 7 deletions
6
src/events/routes.ts
Normal file
6
src/events/routes.ts
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
import type { RouteDef } from "../route-config";
|
||||||
|
import { EventsRoute } from "./routes/Events";
|
||||||
|
|
||||||
|
const routes: RouteDef[] = [EventsRoute];
|
||||||
|
|
||||||
|
export default routes;
|
22
src/events/routes/Events.ts
Normal file
22
src/events/routes/Events.ts
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
import type { LocationDescriptorObject } from "history";
|
||||||
|
import { generatePath } from "react-router-dom";
|
||||||
|
import type { RouteDef } from "../../route-config";
|
||||||
|
import { EventsSection } from "../EventsSection";
|
||||||
|
|
||||||
|
export type EventsTab = "userEvents" | "adminEvents";
|
||||||
|
|
||||||
|
export type EventsParams = {
|
||||||
|
realm: string;
|
||||||
|
tab?: EventsTab;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const EventsRoute: RouteDef = {
|
||||||
|
path: "/:realm/events/:tab?",
|
||||||
|
component: EventsSection,
|
||||||
|
breadcrumb: (t) => t("events:title"),
|
||||||
|
access: "view-events",
|
||||||
|
};
|
||||||
|
|
||||||
|
export const toEvents = (params: EventsParams): LocationDescriptorObject => ({
|
||||||
|
pathname: generatePath(EventsRoute.path, params),
|
||||||
|
});
|
|
@ -6,7 +6,7 @@ import authenticationRoutes from "./authentication/routes";
|
||||||
import clientScopesRoutes from "./client-scopes/routes";
|
import clientScopesRoutes from "./client-scopes/routes";
|
||||||
import clientRoutes from "./clients/routes";
|
import clientRoutes from "./clients/routes";
|
||||||
import { DashboardSection } from "./dashboard/Dashboard";
|
import { DashboardSection } from "./dashboard/Dashboard";
|
||||||
import { EventsSection } from "./events/EventsSection";
|
import eventRoutes from "./events/routes";
|
||||||
import { GroupsSection } from "./groups/GroupsSection";
|
import { GroupsSection } from "./groups/GroupsSection";
|
||||||
import { SearchGroups } from "./groups/SearchGroups";
|
import { SearchGroups } from "./groups/SearchGroups";
|
||||||
import {
|
import {
|
||||||
|
@ -48,16 +48,11 @@ export const routes: RouteDef[] = [
|
||||||
...authenticationRoutes,
|
...authenticationRoutes,
|
||||||
...clientRoutes,
|
...clientRoutes,
|
||||||
...clientScopesRoutes,
|
...clientScopesRoutes,
|
||||||
|
...eventRoutes,
|
||||||
...realmRoleRoutes,
|
...realmRoleRoutes,
|
||||||
...realmRoutes,
|
...realmRoutes,
|
||||||
...sessionRoutes,
|
...sessionRoutes,
|
||||||
...userRoutes,
|
...userRoutes,
|
||||||
{
|
|
||||||
path: "/:realm/events/:tab?",
|
|
||||||
component: EventsSection,
|
|
||||||
breadcrumb: (t) => t("events:title"),
|
|
||||||
access: "view-events",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
path: "/:realm/realm-settings/:tab?",
|
path: "/:realm/realm-settings/:tab?",
|
||||||
component: RealmSettingsSection,
|
component: RealmSettingsSection,
|
||||||
|
|
Loading…
Reference in a new issue