The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Rocket.Chat/client/helpers/createRouteGroup.js

31 lines
714 B

import { FlowRouter } from 'meteor/kadira:flow-router';
import { renderRouteComponent } from '../reactAdapters';
export const createRouteGroup = (name, prefix, importRouter) => {
const routeGroup = FlowRouter.group({
name,
prefix,
});
const registerRoute = (path, { lazyRouteComponent, props, action, ...options } = {}) => {
routeGroup.route(path, {
...options,
action: (params, queryParams) => {
if (action) {
action(params, queryParams);
return;
}
renderRouteComponent(importRouter, {
template: 'main',
region: 'center',
propsFn: () => ({ lazyRouteComponent, ...options, params, queryParams, ...props }),
});
},
});
};
return registerRoute;
};