infrastructure-components
Version:
Infrastructure-Components configure the infrastructure of your React-App as part of your React-Components.
33 lines • 1.22 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,
};
const routeProps = {
middlewares: libs_1.getChildrenArray(props.children)
.filter(child => middleware_component_1.isMiddleware(child)),
exact: true
};
return Object.assign(props, componentProps, routeProps);
};
exports.isRoute = (component) => {
return component !== undefined &&
component.instanceType === exports.ROUTE_INSTANCE_TYPE;
};
//# sourceMappingURL=route-component.js.map