infrastructure-components
Version:
Infrastructure-Components configure the infrastructure of your React-App as part of your React-Components.
35 lines • 1.45 kB
JavaScript
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const types_1 = __importDefault(require("../types"));
const middleware_component_1 = require("../middleware/middleware-component");
const libs_1 = require("../libs");
exports.ROUTE_INSTANCE_TYPE = "RouteComponent";
/**
* The WebApp is a client that runs in the browser, SPA or SSR
*
* @param props
*/
exports.default = (props) => {
//console.log ("route: ",props );
const componentProps = {
infrastructureType: types_1.default.INFRASTRUCTURE_TYPE_COMPONENT,
instanceType: exports.ROUTE_INSTANCE_TYPE,
instanceId: undefined,
insulatesChildComponent: (child) => {
// a route insulates (handles itself) middlewares and does not privide to higher levels
return middleware_component_1.isMiddleware(child);
}
};
const routeProps = {
middlewares: libs_1.findComponentRecursively(props.children, middleware_component_1.isMiddleware),
};
return Object.assign({}, props, componentProps, routeProps, { exact: props.exact === undefined ? true : props.exact });
};
exports.isRoute = (component) => {
return component !== undefined &&
component.instanceType === exports.ROUTE_INSTANCE_TYPE;
};
//# sourceMappingURL=route-component.js.map
;